I wrote an interactive function to get the contents of a line from the current position of point to the last non-blank character on a line.
However, when after evaluating the function with
C-x C-e, going to a buffer with random-text and then typing
M-x get-substring-till-end-of-line I would have expected the answer to be printed in the minibuffer.
But nothing prints in the mini-buffer.
Here is the code.
(defun get-substring-till-end-of-line () "Get as a subtring all the characters from the current-position of point upto the last non-white space character of the current line." (interactive) (save-excursion (let ((start (point)) end) (forward-line 1) (re-search-backward "[^[:space:]]") (setq end (point)) (buffer-substring-no-properties start end))))