bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#5366: (un)comment-line macros


From: Mads Jensen
Subject: bug#5366: (un)comment-line macros
Date: Tue, 12 Jan 2010 20:39:39 +0100
User-agent: Thunderbird 2.0.0.23 (X11/20090817)

Hi,

I wrote the following two very simple macros. Nevertheless, I find them
very useless, and would be pleased if you could include them in a future
version of emacs.

(defun comment-line ()
  "comments the line"
  (interactive)
  (let ((start (point-at-bol))
        (end (point-at-eol)))
    (save-excursion
      (indent-region start end)
      (comment-region start end)
      (if (not (string= major-mode "text-mode"))
          (indent-for-tab-command)))))

(defun uncomment-line ()
  "uncomments the current line"
  (interactive)
  (let ((start (point-at-bol))
        (end (point-at-eol)))
    (save-excursion
      (uncomment-region start end)
      (if (not (string= major-mode "text-mode"))
          (indent-region start end)))))

I bound them to "C-c l" and "C-c u" respectively.

Yours sincerely,
Mads Jensen

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]