* Bug in comment-region?
@ 2016-02-03 22:51 Thorsten Jolitz
2016-02-04 0:26 ` Emanuel Berg
2016-02-04 0:29 ` Emanuel Berg
0 siblings, 2 replies; 4+ messages in thread
From: Thorsten Jolitz @ 2016-02-03 22:51 UTC (permalink / raw)
To: help-gnu-emacs
Hi List,
In emacs-lisp-mode, when marking lines 2 and 3 and calling M-x comment-region
,----
| ;; * WAITING foo
| - State "WAITING" from "TODO" [2016-02-03 Mi 23:46] \\
| waiting for bar
`----
I get this
,----
| ;; * WAITING foo
| ;; - State "WAITING" from "TODO" [2016-02-03 Mi 23:46] \\
| ;; waiting for bar
`----
which looks like a bug to me - the comment chars should always be at
BOL, shouldn't they?
--
cheers,
Thorsten
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Bug in comment-region?
2016-02-03 22:51 Bug in comment-region? Thorsten Jolitz
@ 2016-02-04 0:26 ` Emanuel Berg
2016-02-04 0:29 ` Emanuel Berg
1 sibling, 0 replies; 4+ messages in thread
From: Emanuel Berg @ 2016-02-04 0:26 UTC (permalink / raw)
To: help-gnu-emacs
Thorsten Jolitz <tjolitz@gmail.com> writes:
> which looks like a bug to me - the comment chars
> should always be at BOL, shouldn't they?
Not if you are to trust the `comment-region'
docstring:
By default, the `comment-start' markers are
inserted at the current indentation of the region
--
underground experts united
http://user.it.uu.se/~embe8573
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Bug in comment-region?
2016-02-03 22:51 Bug in comment-region? Thorsten Jolitz
2016-02-04 0:26 ` Emanuel Berg
@ 2016-02-04 0:29 ` Emanuel Berg
2016-02-04 21:53 ` Thorsten Jolitz
1 sibling, 1 reply; 4+ messages in thread
From: Emanuel Berg @ 2016-02-04 0:29 UTC (permalink / raw)
To: help-gnu-emacs
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.")))
--
underground experts united
http://user.it.uu.se/~embe8573
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Bug in comment-region?
2016-02-04 0:29 ` Emanuel Berg
@ 2016-02-04 21:53 ` Thorsten Jolitz
0 siblings, 0 replies; 4+ messages in thread
From: Thorsten Jolitz @ 2016-02-04 21:53 UTC (permalink / raw)
To: help-gnu-emacs
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
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2016-02-04 21:53 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-03 22:51 Bug in comment-region? Thorsten Jolitz
2016-02-04 0:26 ` Emanuel Berg
2016-02-04 0:29 ` Emanuel Berg
2016-02-04 21:53 ` Thorsten Jolitz
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).