unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* cite (comment) in message mode
@ 2017-12-14  7:07 Emanuel Berg
  0 siblings, 0 replies; only message in thread
From: Emanuel Berg @ 2017-12-14  7:07 UTC (permalink / raw)
  To: help-gnu-emacs; +Cc: emacs-devel

Another quality release from The Secret Empire.

Now you can set the comment non-DWIM style with
C-u. So C-u 0 removes comment(s) and above that
it nests up...

(defun message-cite-region (beg end &optional levels)
  (interactive "*r\np")
  (goto-char beg)
  (beginning-of-line)
  (let*((first-line (line-number-at-pos))
        (last-line  (line-number-at-pos end))
        (num-lines  (1+ (- last-line first-line))) )
    (dotimes (unused num-lines)
      (while (looking-at ">") (delete-char 1)) ; TODO: away hard-code
      (when  (looking-at " ") (delete-char 1))
      (when (> levels 0)
        (insert-char ?> levels)
        (insert-char ?\ ) ) ; this repairs ugly >quotes as well
      (forward-line 1) )
    ;; clean up
    (goto-char (point-min))
    (forward-line (1- last-line))
    (end-of-line)
    (when (region-active-p) (keyboard-quit)) ))
(defalias 'mcr 'message-cite-region) ; or bind to M-; in message-mode

-- 
underground experts united
http://user.it.uu.se/~embe8573




^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2017-12-14  7:07 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-12-14  7:07 cite (comment) in message mode Emanuel Berg

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).