Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Tree: 04280d39bc
Fetching contributors…

Cannot retrieve contributors at this time

47 lines (42 sloc) 1.47 KB
(defun number-of-chars-in-line-above (&optional position direction-function)
"Return the number of characters in the line above. If
optional POSITION is specified, goto that character first. If
optional DIRECTION-FUNCTION is specified, use that function to
get to the line (instead of the default `previous-line')."
(if position (goto-char position))
(if (not direction-function) (setq direction-function 'previous-line))
(funcall direction-function)
(let (b e)
(setq b (point))
(setq e (point))
(- e b))))
(defun insert-same-number-of-chars-as-line-above (char)
(interactive "kCharacter: ")
(dotimes (i (number-of-chars-in-line-above)) (insert char)))
(defun as-one-line nil
(goto-char (point-min))
(kill-region (point-min) (point-max)))))
(defun delete-trailing-whitespace-nothere ()
"Delete trailing whitespace, except on the current line if it is all whitespace."
(let (current-whitespace)
(when (save-excursion
(looking-at "\\([[:space:]]+\\)$"))
(setq current-whitespace (match-string 0)))
(when current-whitespace
(insert current-whitespace)))
(when current-whitespace
(provide 'text-extras)
Jump to Line
Something went wrong with that request. Please try again.