help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to test if the current line contains only white-spache?


From: Marcin Borkowski
Subject: Re: How to test if the current line contains only white-spache?
Date: Thu, 19 Nov 2015 16:20:34 +0100
User-agent: mu4e 0.9.15; emacs 25.0.50.1

On 2015-11-19, at 14:54, Rolf Ade <rolf@pointsman.de> wrote:

> Yes, this is, what my instinct also telling me. But this instinct was
> trained by other programming languages and environments. I'm aware, that
> it may be not applicable to emacs lisp / emacs.

And you're right: it's not.

> Discussing programming concepts at such 'meta level' is difficult. But
> maybe some may express their thinking about this. Is this 'moving point
> around' in emacs lisp programming code the "right thing" to do [...]

Yes it is.

See e.g. answers to this question:
http://emacs.stackexchange.com/questions/2120/how-to-insert-text-after-point
(not the same case, but similar) or many definitions in Emacs core.

You can e.g. grep for `save-excursion' in simple.el and other places.
A few highlights: check the definitions of `line-number-at-pos',
`kill-line', `insert-buffer', `next-line', `mark-word' and many others.
It turns out that e.g. this is quite a common idiom:

(save-excursion
  (move-point-someplace-of-interest)
  (point))

Best,

-- 
Marcin Borkowski
http://octd.wmi.amu.edu.pl/en/Marcin_Borkowski
Faculty of Mathematics and Computer Science
Adam Mickiewicz University



reply via email to

[Prev in Thread] Current Thread [Next in Thread]