all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#26049: 25.2; Extra lines not added to comment
@ 2017-03-10 13:41 Antonin Houska
  2017-03-28  3:29 ` npostavs
  0 siblings, 1 reply; 9+ messages in thread
From: Antonin Houska @ 2017-03-10 13:41 UTC (permalink / raw)
  To: 26049

[-- 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))

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2017-11-07  0:07 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-03-10 13:41 bug#26049: 25.2; Extra lines not added to comment Antonin Houska
2017-03-28  3:29 ` 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

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.