1

What is a good way to replace (line-end-position) with a function that doesn't include trailing whitespace?

Drew
  • 77,472
  • 10
  • 114
  • 243
ideasman42
  • 8,786
  • 1
  • 32
  • 114

1 Answers1

2

Without an argument, (line-end-position) is functionally equivalent to (save-excursion (end-of-line) (point)). Armed with that knowledge, your custom function could be defined as follows:

(defun my-line-end-position ()
  (save-excursion
    (end-of-line)
    (skip-syntax-backward "-")
    (point)))
ideasman42
  • 8,786
  • 1
  • 32
  • 114
wasamasa
  • 22,178
  • 1
  • 66
  • 99