Last thought before death? I read somewhere (perhaps in an unreliable introduction to Tibetan beliefs) that rebirth is conditioned by the last thought before death (or perhaps affected by a thought or desire that you have after death).

Another belief that's similar, if not the same, is that a person may have had some (good or bad) life but that having some (bad or good) final dying thought determines their rebirth (e.g. into hell or heaven).


When (historically) was this view introduced into scriptures?
What is the evidence and/or reasoning for this view?
Is this view espoused by all schools of Buddhism, or do different traditions have different views?


It seems to me that my mind has or generates lots of semi-random thoughts: they're like memories, or dream fragments, etc., they come and go. That kind of ideation (often visual images, fragmentary visions of people I've known or of places I've seen) is especially apparent when I'm asleep-and-dreaming. They're also apparent if I'm feverish and/or delirious. I expect that people often aren't at their most mentally acute when they're dying.


Are we supposed/expected to have some kind of control over such thoughts/ideas/images? Or are these too anatta, and neither 'self' nor 'controlled by self'? If it's true that they are not self, and not subject to control-by-self, then how are they associated with the kamma which affects rebirth? Or is it some other, different kind of "last thought" which affects rebirth?


Googling to try to begin to research this topic I found this brief article which describes 'the Last Thought Moment' and which says for example,


  Later still, the theory developed that the last thought moment (cuticitta) a person has before they die will determine their next life. This idea, now current in Theravāda, seems to be an unjustified development of the Buddha’s teachings and at odds with his idea of kamma and the efficacy of morality.



Is this article reliable, i.e. is true as far as you know, or does it say some things that would contradict or add to?
The account of the Buddha's own death is of his having mastered jhanas, and making use of that ability at the time of his death:


  And the Blessed One entered the first jhana. Rising from the first jhana etc.


Is this what everyone is supposed to do when they die? Must we (and can we) hope that we will be so lucid at the time of death? Aren't people often unconscious or asleep or perhaps in a coma or something when they die?
Can you summarize what conclusion you draw, about


How to practice Buddhism now?
What if anything to expect or hope at time of death?
Whether death and rebirth are even especially worth thinking about (or whether we're even capable of thinking about them), or whether it's more important/useful to think about this life?
"I read somewhere (perhaps in an unreliable introduction to Tibetan beliefs) that rebirth is conditioned by the last thought before death (or perhaps affected by a thought or desire that you have after death). 

Another belief that's similar, if not the same, is that a person may have had some (good or bad) life but that having some (bad or good) final dying thought determines their rebirth (e.g. into hell or heaven).""

In the pali canon there are suttas that suggest the "state of mind" in the last moments before death has a strong influence on where one reappears after dying. Two suttas on this subject:


  "It would be better, bhikkhus, for the ear faculty to be lacerated by a sharp iron stake burning, blazing, and glowing, than for one to grasp the sign through the features in a sound cognizable by the ear. For if consciousness should stand tied to gratification in the sign or in the features, and if one should die on that occasion, it is possible that one will go to one of two destinations: hell or the animal realm. Having seen this danger, I speak thus."
  
  -- SN 35.235


And:


  (i) “Now, Ananda, there is the person who has killed living beings here… has had wrong view. And on the dissolution of the body, after death, he reappears in the states of deprivation, in an unhappy destination, in perdition, in hell. But (perhaps) the evil kamma producing his suffering was done by him earlier, or the evil kamma producing his suffering was done by him later, or wrong view was undertaken and completed by him at the time of his death. And that was why, on the dissolution of the body, after death, he reappeared in the states of deprivation, in an unhappy destination, in perdition, in hell. But since he has killed living beings here… has had wrong view, he will feel the result of that here and now, or in his next rebirth, or in some subsequent existence.  
  
  (ii) “Now there is the person who has killed living beings here… has had wrong view. And on the dissolution of the body, after death, he reappears in a happy destination, in the heavenly world. But (perhaps) the good kamma producing his happiness was done by him earlier, or the good kamma producing his happiness was done by him later, or right view was undertaken and completed by him at the time of his death. [...]  
  
  (iii) “Now there is the person who has abstained from killing living beings here… has had right view. And on the dissolution of the body, after death, he reappears in a happy destination, in the heavenly world. But (perhaps) the good kamma producing his happiness was done by him earlier, or the good kamma producing his happiness was done by him later, or right view was undertaken and completed by him at the time of his death.  [...]  
  
  (iv) “Now there is the person who has abstained from killing living beings here… has had right view. And on the dissolution of the body, after death, he reappears in the states of deprivation, in an unhappy destination, in perdition, in hell. But (perhaps) the evil kamma producing his suffering was done by him earlier, or the evil kamma producing his suffering was done by him later, or wrong view was undertaken and completed by him at the time of his death.
  
  -- MN 136:


That is, SN 35.235 discusses the danger of having consciousness tied to the gratification of sensual pleasures at the time of death. Also, even though we read frequently in the suttas that wrong view leads one to reappearing in hell, MN 136 discusses the (seemingly proeminent) role of right and wrong view at the time of the death.

"[...] Are we supposed/expected to have some kind of control over such thoughts/ideas/images?"

Sure, to the extent we can think over, investigate, train and, thus, transform our thoughts, ideas, convictions, beliefs, and knowledges.

Naturally, an untrained mind might easily produce thoughts, ideas and images against one's desire and a non virtuous person might easily incline her mind to unwholesome states.

"If it's true that they [thoughts/ideasi/images] are not self, and not subject to control-by-self, then how are they associated with the kamma which affects rebirth?"


  "It is volition, bhikkhus, that I call kamma. For having willed, one acts by body, speech or mind"
  
  -- AN 6.63


Thoughts (perhaps specially the ones manifesting inclinations) are kamma. That is the association.

EDIT: I don't believe that, say, if the thought of ceasing to exist after death, or if the thought of having a permanent soul (or any other wrong view) appears in one's mind, that it would constitute wrong view -- one needs to actually believe these. Additionally, I'm sure that a thought about hate is not a thought of hate -- otherwise, it would be impossible to be virtuous and think &amp; talk about such things. Furthermore, I understand thoughts originated by will are kamma, but still, one should ask what was that will that manifested such thoughts.

"Is this article reliable, i.e. is true as far as you know, or does it say some things that would contradict or add to?"

From the above we can conclude there is a basis in the suttas for the idea that the last moments may have a strong influence in determining one's destination (but I don't see how "the last thought moment a person has before they die will determine their next life." could be based on the suttas). 

I fail to see this as conflicting, given the teachings on kamma -- specially the ones above, and this next one:


  Any kamma, bhikkhus, fashioned through [greed, hatred, delusion] [...] rippens wherever the individual is reborn. Wherever that kamma rippens, it is there that one experiences its result, either in this very life, or in the [next] rebirth, or on some subsequent occasion.
  
  -- AN 3.34


[there is a some polemic surrounding that particular passage, but the quote above should be safe to further elucidate these points].

"The account of the Buddha's own death is of his having mastered jhanas, and making use of that ability at the time of his death [...] Is this what everyone is supposed to do when they die? Must we (and can we) hope that we will be so lucid at the time of death? Aren't people often unconscious or asleep or perhaps in a coma or something when they die?"

I don't think most people are unconscious, asleep or confused when dying -- some, surely. Though I'm sure that some people are very lucid when dying (not necessarily buddhist monks).

I can't say for sure going through jhanas is the "de facto itinerary" for parinibbāna, only that this what the Buddha seemed to have done. And that if we know how to attain jhana, that that is probably what one wants to do before dying, if one hasn't attained arahantship:


  "Here, bhikkhus, secluded from sensual pleasures [...] some person enters and dwells in the first jhāna [...]. He relishes it, desires it, and finds satisfaction in it. If he is firm in it, focused on it, often dwells in it, and has not lost it when he dies, he is reborn in companionship with the devas of Brahmā's company.  
  
  [...] some person enters and dwells in the second jhāna [...]. If he is firm in it, focused on it, often dwells in it, and has not lost it when he dies, he is reborn in companionship with the devas of streaming radiance. [...]"  
  
  [...] some person enters and dwells in the third jhāna [...]. If he is firm in it, focused on it, often dwells in it, and has not lost it when he dies, he is reborn in companionship with the devas of refulgent glory. [...]"
  
  [...] some person enters and dwells in the fourth jhāna [...]. If he is firm in it, focused on it, often dwells in it, and has not lost it when he dies, he is reborn in companionship with the devas of great fruit. [...]"
  
  -- AN 4.124


Also, following the same formula of AN 4.124, AN 4.125 associates:


loving-kindness to the company of Brahmā's company
compassion to the company of devas of stream radiance
altruistic joy to the company of devas of refulgent glory
equanimity to the company of devas of great fruit


[Additionally, it also states that a Buddha's disciple, at the end of the life span in these realms, attains nibbāna there, contrasted with a wordling that, after dying in such realms, reappears in a lower realm. AN 4.126 adds to the formula the contemplation of the three marks, which makes one reappears in companionship with the devas of the pure abodes -- a destination not shared with wordlings].

"Can you summarize what conclusion you draw, about..."

In regard to the subject in question:


"How to practice Buddhism now?"

Stay away from unwholesome acts of body, speech and mind, nurture wholesome acts, restrain the 6 senses (sigh this is hard). Study, investigate, meditate. Rinse &amp; repeat... (at least, this is what I try to do).
"What if anything to expect or hope at time of death?"

If jhana is not an option, at the time of my death, I would like to remember to be mindful and equanimous while it happens -- no expectations or hope.
"Whether death and rebirth are even especially worth thinking about (or whether we're even capable of thinking about them), or whether it's more important/useful to think about this life?"

I see no danger in thinking about it. It concerns our existence, after all. Moreover, many religions emphasize the prize of the after life -- this seems to be an important ad to gather adepts.

In the canon, I think a particular sutta might tackle this, titled by Thanissaro Bhikkhu as "A Safe Bet" (MN 60):


  A1. "Now, householders, of those contemplatives &amp; brahmans who hold this doctrine, hold this view — 'There is nothing given, nothing offered, nothing sacrificed. There is no fruit or result of good or bad actions. There is no this world, no next world, no mother, no father, no spontaneously reborn beings; no brahmans or contemplatives who, faring rightly and practicing rightly, proclaim this world and the next after having directly known and realized it for themselves' — it can be expected that, shunning these three skillful activities — good bodily conduct, good verbal conduct, good mental conduct — they will adopt &amp; practice these three unskillful activities: bad bodily conduct, bad verbal conduct, bad mental conduct. Why is that? Because those venerable contemplatives &amp; brahmans do not see, in unskillful activities, the drawbacks, the degradation, and the defilement; nor in skillful activities the rewards of renunciation, resembling cleansing.  
  
  A2. "Because there actually is the next world, the view of one who thinks, 'There is no next world' is his wrong view. Because there actually is the next world, when he is resolved that 'There is no next world,' that is his wrong resolve. Because there actually is the next world, when he speaks the statement, 'There is no next world,' that is his wrong speech. Because there actually is the next world, when he says that 'There is no next world,' he makes himself an opponent to those arahants who know the next world. Because there actually is the next world, when he persuades another that 'There is no next world,' that is persuasion in what is not true Dhamma. And in that persuasion in what is not true Dhamma, he exalts himself and disparages others. Whatever good habituation he previously had is abandoned, while bad habituation is manifested. And this wrong view, wrong resolve, wrong speech, opposition to the arahants, persuasion in what is not true Dhamma, exaltation of self, &amp; disparagement of others: These many evil, unskillful activities come into play, in dependence on wrong view.  
  
  A3. "With regard to this, an observant person considers thus: 'If there is no next world, then — with the breakup of the body, after death — this venerable person has made himself safe. But if there is the next world, then this venerable person — on the breakup of the body, after death — will reappear in a plane of deprivation, a bad destination, a lower realm, hell. Even if we didn't speak of the next world, and there weren't the true statement of those venerable contemplatives &amp; brahmans, this venerable person is still criticized in the here-&amp;-now by the observant as a person of bad habits &amp; wrong view: [2] one who holds to a doctrine of non-existence.' If there really is a next world, then this venerable person has made a bad throw twice: in that he is criticized by the observant here-&amp;-now, and in that — with the breakup of the body, after death — he will reappear in a plane of deprivation, a bad destination, a lower realm, hell. Thus this safe-bet teaching, when poorly grasped &amp; poorly adopted by him, covers (only) one side, and leaves behind the possibility of the skillful.