From: Antonin Houska <ah@cybertec.at>
To: 26049@debbugs.gnu.org
Subject: bug#26049: 25.2; Extra lines not added to comment
Date: Fri, 10 Mar 2017 14:41:15 +0100 [thread overview]
Message-ID: <29145.1489153275@localhost> (raw)
[-- Attachment #1: Type: text/plain, Size: 5402 bytes --]
Even though I have the following customizations in place
'(comment-multi-line t)
'(comment-style (quote extra-line))
comment-region command produces this
/* some comment */
rather than this
/*
* some comment
*/
Attached is a patch that I use to fix the issue on my workstation. Besides
fixing the (supposed) off-by-one error, the patch also removes trailing
whitespace from the initial line of the comment ("/* "). (My knowledge of
Elisp is not too advanced so I wonder if there's simpler way to trim
whitespace from a string.)
In GNU Emacs 25.2.3 (x86_64-suse-linux-gnu, X toolkit, Xaw scroll bars)
of 2017-03-10 built on linux-j735
Repository revision: 6e788ef0e262fafc014c21f4ad52cc5dc9f1715b
Windowing system distributor 'The X.Org Foundation', version 11.0.11702000
System Description: openSUSE Leap 42.1 (x86_64)
Configured using:
'configure --prefix=/home/ah/emacs 'CC=ccache cc''
Configured features:
XPM JPEG TIFF GIF PNG SOUND NOTIFY GNUTLS LIBXML2 ZLIB
TOOLKIT_SCROLL_BARS LUCID X11
Important settings:
value of $EMACSLOADPATH: :/home/ah/repos/pgqa/lisp/pgqa
value of $LANG: en_US.UTF-8
value of $XMODIFIERS: @im=local
locale-coding-system: utf-8-unix
Major mode: Messages
Minor modes in effect:
tooltip-mode: t
global-eldoc-mode: t
electric-indent-mode: t
mouse-wheel-mode: t
file-name-shadow-mode: t
global-font-lock-mode: t
font-lock-mode: t
blink-cursor-mode: t
auto-composition-mode: t
auto-encryption-mode: t
auto-compression-mode: t
buffer-read-only: t
column-number-mode: t
line-number-mode: t
global-visual-line-mode: t
visual-line-mode: t
transient-mark-mode: t
Recent messages:
Loading delsel...done
For information about GNU Emacs and the GNU system, type C-h C-a.
Load-path shadows:
/home/ah/emacs/share/emacs/25.2/lisp/progmodes/ada-xref hides /home/ah/repos/elpa/packages/ada-mode/ada-xref
/home/ah/emacs/share/emacs/25.2/lisp/progmodes/ada-stmt hides /home/ah/repos/elpa/packages/ada-mode/ada-stmt
/home/ah/emacs/share/emacs/25.2/lisp/progmodes/ada-prj hides /home/ah/repos/elpa/packages/ada-mode/ada-prj
/home/ah/emacs/share/emacs/25.2/lisp/progmodes/ada-mode hides /home/ah/repos/elpa/packages/ada-mode/ada-mode
/home/ah/repos/elpa/packages/ada-mode/ada-ref-man hides /home/ah/repos/elpa/packages/ada-ref-man/ada-ref-man
/home/ah/emacs/share/emacs/25.2/lisp/emacs-lisp/cl-generic hides /home/ah/repos/elpa/packages/cl-generic/cl-generic
/home/ah/emacs/share/emacs/25.2/lisp/emacs-lisp/cl-lib hides /home/ah/repos/elpa/packages/cl-lib/cl-lib
/home/ah/emacs/share/emacs/25.2/lisp/obsolete/crisp hides /home/ah/repos/elpa/packages/crisp/crisp
/home/ah/emacs/share/emacs/25.2/lisp/obsolete/landmark hides /home/ah/repos/elpa/packages/landmark/landmark
/home/ah/emacs/share/emacs/25.2/lisp/net/pinentry hides /home/ah/repos/elpa/packages/pinentry/pinentry
/home/ah/emacs/share/emacs/25.2/lisp/emacs-lisp/seq hides /home/ah/repos/elpa/packages/seq/seq
/home/ah/repos/elpa/packages/all/all hides /home/ah/repos/elpa/packages/company/test/all
/home/ah/emacs/share/emacs/25.2/lisp/indent hides /home/ah/repos/elpa/packages/js2-mode/tests/indent
/home/ah/repos/elpa/packages/load-relative/test/install-pkgs hides /home/ah/repos/elpa/packages/loc-changes/test/install-pkgs
/home/ah/repos/elpa/packages/loc-changes/test/test-basic hides /home/ah/repos/elpa/packages/test-simple/test/test-basic
Features:
(shadow sort mail-extr warnings emacsbug message dired format-spec
rfc822 mml mml-sec password-cache epg gnus-util mm-decode mm-bodies
mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail
rfc2047 rfc2045 ietf-drums mm-util help-fns mail-prsvr mail-utils
cc-styles cc-align cc-engine cc-vars cc-defs windmove delsel cus-start
cus-load go-mode-autoloads ggtags etags xref cl-seq project eieio
eieio-core cl-macs compile comint ansi-color ring ewoc finder-inf
package epg-config seq byte-opt gv bytecomp byte-compile cl-extra
help-mode easymenu cconv cl-loaddefs pcase cl-lib time-date mule-util
tooltip eldoc electric uniquify ediff-hook vc-hooks lisp-float-type
mwheel x-win term/common-win x-dnd tool-bar dnd fontset image regexp-opt
fringe tabulated-list newcomment elisp-mode lisp-mode prog-mode register
page menu-bar rfn-eshadow timer select scroll-bar mouse jit-lock
font-lock syntax facemenu font-core frame cl-generic cham georgian
utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean
japanese eucjp-ms cp51932 hebrew greek romanian slovak czech european
ethiopic indian cyrillic chinese charscript case-table epa-hook
jka-cmpr-hook help simple abbrev minibuffer cl-preloaded nadvice
loaddefs button faces cus-face macroexp files text-properties overlay
sha1 md5 base64 format env code-pages mule custom widget
hashtable-print-readable backquote inotify dynamic-setting x-toolkit x
multi-tty make-network-process emacs)
Memory information:
((conses 16 132187 8058)
(symbols 48 24578 0)
(miscs 40 57 129)
(strings 32 28089 5577)
(string-bytes 1 861163)
(vectors 16 18787)
(vector-slots 8 538382 3672)
(floats 8 272 74)
(intervals 56 204 0)
(buffers 976 20)
(heap 1024 37606 923))
--
Antonin Houska
Cybertec Schönig & Schönig GmbH
Gröhrmühlgasse 26
A-2700 Wiener Neustadt
Web: http://www.postgresql-support.de, http://www.cybertec.at
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: comment_extra_line.diff --]
[-- Type: text/x-diff, Size: 1510 bytes --]
diff --git a/lisp/newcomment.el b/lisp/newcomment.el
new file mode 100644
index 1af8929..75dbb07
*** a/lisp/newcomment.el
--- b/lisp/newcomment.el
*************** the region rather than at left margin."
*** 1139,1144 ****
--- 1139,1149 ----
;; make the leading and trailing lines if requested
(when lines
+ ;; Trim trailing whitespace from cs if there's some.
+ (let ((wp-pos (string-match "\\s-+$" cs)))
+ (if wp-pos
+ (setq cs (substring cs 0 wp-pos))))
+
(let ((csce
(comment-make-extra-lines
cs ce ccs cce min-indent max-indent block)))
*************** changed with `comment-style'."
*** 1209,1215 ****
(progn (goto-char end) (end-of-line) (skip-syntax-backward " ")
(<= (point) end))
(or block (not (string= "" comment-end)))
! (or block (progn (goto-char beg) (search-forward "\n" end t)))))
;; don't add end-markers just because the user asked for `block'
(unless (or lines (string= "" comment-end)) (setq block nil))
--- 1214,1222 ----
(progn (goto-char end) (end-of-line) (skip-syntax-backward " ")
(<= (point) end))
(or block (not (string= "" comment-end)))
! (or block (progn (goto-char beg) (search-forward
! "\n"
! (min (1+ end) (point-max)) t)))))
;; don't add end-markers just because the user asked for `block'
(unless (or lines (string= "" comment-end)) (setq block nil))
next reply other threads:[~2017-03-10 13:41 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-10 13:41 Antonin Houska [this message]
2017-03-28 3:29 ` bug#26049: 25.2; Extra lines not added to comment npostavs
2017-03-28 12:52 ` Antonin Houska
2017-03-29 2:25 ` npostavs
2017-03-29 6:54 ` Antonin Houska
2017-09-23 7:41 ` Antonin Houska
2017-09-23 14:37 ` Noam Postavsky
2017-11-06 10:14 ` Antonin Houska
2017-11-07 0:07 ` Noam Postavsky
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=29145.1489153275@localhost \
--to=ah@cybertec.at \
--cc=26049@debbugs.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).