all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* last-non-white-space-on-line
@ 2006-06-03 11:07 Andreas Roehler
  2006-06-05  8:10 ` last-non-white-space-on-line Arndt Jonasson
  0 siblings, 1 reply; 4+ messages in thread
From: Andreas Roehler @ 2006-06-03 11:07 UTC (permalink / raw)



Hi, 

is there a function known to jump to the last
non-whitspace char in line - as (back-to-indentation)
does in the other direction?

Could write something like 

(defun last-non-white-space-on-line ()
  " "
  (interactive)
  (end-of-line)
  (skip-chars-backward "[ \t]")) 

Nonetheles, would prever to use an already existing
macro.

Thanks

Andreas Roehler

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: last-non-white-space-on-line
@ 2006-06-05  6:53 martin rudalics
  0 siblings, 0 replies; 4+ messages in thread
From: martin rudalics @ 2006-06-05  6:53 UTC (permalink / raw)


 >   (skip-chars-backward "[ \t]"))

I'd suggest

   (skip-chars-backward " \t"))

instead.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: last-non-white-space-on-line
  2006-06-03 11:07 last-non-white-space-on-line Andreas Roehler
@ 2006-06-05  8:10 ` Arndt Jonasson
  2006-06-06 11:23   ` last-non-white-space-on-line Andreas Roehler
  0 siblings, 1 reply; 4+ messages in thread
From: Arndt Jonasson @ 2006-06-05  8:10 UTC (permalink / raw)


Andreas Roehler wrote:
> is there a function known to jump to the last
> non-whitspace char in line - as (back-to-indentation)
> does in the other direction?
>
> Could write something like
>
> (defun last-non-white-space-on-line ()
>   " "
>   (interactive)
>   (end-of-line)
>   (skip-chars-backward "[ \t]"))
>
> Nonetheles, would prever to use an already existing
> macro.

Not one function of course, but I would do C-e M-\
This deletes the whitespace, but that's what I want to happen
anyway if I'm not adding more to the line.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: last-non-white-space-on-line
  2006-06-05  8:10 ` last-non-white-space-on-line Arndt Jonasson
@ 2006-06-06 11:23   ` Andreas Roehler
  0 siblings, 0 replies; 4+ messages in thread
From: Andreas Roehler @ 2006-06-06 11:23 UTC (permalink / raw)


Arndt Jonasson wrote:

> Andreas Roehler wrote:
>> is there a function known to jump to the last
>> non-whitspace char in line - as (back-to-indentation)
>> does in the other direction?
>>
>> Could write something like
>>
>> (defun last-non-white-space-on-line ()
>>   " "
>>   (interactive)
>>   (end-of-line)
>>   (skip-chars-backward "[ \t]"))
>>
>> Nonetheles, would prever to use an already existing
>> macro.
> 
> Not one function of course, but I would do C-e M-\
> This deletes the whitespace, but that's what I want to happen
> anyway if I'm not adding more to the line.

Basicaly you are right, don't imagine any use of
whitespaces at the end of line.

Thanks

Andreas Roehler


BTW.: Got a hint concerning an error in the previous
draft. Here a better one:

(defun last-non-white-space-on-line ()
  " "
  (interactive)
  (end-of-line)
  (skip-chars-backward " \t"))

;; To do it with  (delete-horizontal-space):    

(defun last-non-white-space-on-line ()
  " "
  (interactive)
  (end-of-line)
  (delete-horizontal-space)        
  ;;   (skip-chars-backward " \t")
  (backward-char 1))

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2006-06-06 11:23 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-06-03 11:07 last-non-white-space-on-line Andreas Roehler
2006-06-05  8:10 ` last-non-white-space-on-line Arndt Jonasson
2006-06-06 11:23   ` last-non-white-space-on-line Andreas Roehler
  -- strict thread matches above, loose matches on Subject: below --
2006-06-05  6:53 last-non-white-space-on-line martin rudalics

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.