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

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

Re: Bug in comment-region?


From: Thorsten Jolitz
Subject: Re: Bug in comment-region?
Date: Thu, 04 Feb 2016 22:53:47 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux)

Emanuel Berg <embe8573@student.uu.se> writes:

> Thorsten Jolitz <tjolitz@gmail.com> writes:
>
>> which looks like a bug to me - the comment chars
>> should always be at BOL, shouldn't they?
>
> Try this:
>
>     (setq comment-styles '(plain . (nil nil nil nil "Start comment at
> BOL.")))

So its a feature not a bug, thanks for the hint. I used 

,----
| (defun outshine-comment-region (beg end &optional arg)
|        "Use comment-style that always inserts at BOL.
| Call `comment-region' with a comment-style that guarantees
|    insertion of comment-start markers at beginning-of-line."
|        (interactive "r")
|        (let ((comment-style
|               (if (member comment-style '(indent-or-triple indent))
|                   'plain
|                 comment-style)))
|          (comment-region beg end arg)))
`----

now, because normally outshine should be major-mode agnostic and just
use the comment settings of the programming mode at hand. Only tested
with Emacs Lisp though ...

-- 
cheers,
Thorsten




reply via email to

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