GNU bug report logs - #11090
24.0.94; Allow customization of inline-comment offset

Previous Next

Package: emacs;

Reported by: Philipp Haselwarter <philipp.haselwarter <at> gmx.de>

Date: Sun, 25 Mar 2012 17:25:01 UTC

Severity: normal

Found in version 24.0.94

Fixed in version 24.2

Done: Stefan Monnier <monnier <at> iro.umontreal.ca>

Bug is archived. No further changes may be made.

Full log


Message #10 received at 11090-done <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Philipp Haselwarter <philipp.haselwarter <at> gmx.de>
Cc: 11090-done <at> debbugs.gnu.org
Subject: Re: bug#11090: 24.0.94; Allow customization of inline-comment offset
Date: Sun, 25 Mar 2012 14:41:27 -0400
> The attached patch allows for `comment-indent' to configure that offset,
> that is currently hard-coded to one space, by introducing the new
> variable `comment-inline-offset'.

I think it's a good idea, thank you.
Installed in the `pending' branch, for 24.2.
I also installed the following patch on top of it.


        Stefan


=== modified file 'lisp/newcomment.el'
--- lisp/newcomment.el	2012-03-25 18:37:24 +0000
+++ lisp/newcomment.el	2012-03-25 18:38:46 +0000
@@ -268,7 +268,6 @@
   :type '(choice string integer (const nil))
   :group 'comment)
 
-;;;###autoload
 (defcustom comment-inline-offset 1
   "Inline comments have to be preceded by at least this many spaces.
 This is usefull when style-conventions require a certain minimal offset.
@@ -598,7 +597,7 @@
                    (save-excursion (end-of-line) (current-column)))))
         (other nil)
         (min (save-excursion (skip-chars-backward " \t")
-                             (1+ (current-column)))))
+                             (+ comment-inline-offset (current-column)))))
     ;; Fix up the range.
     (if (< max min) (setq max min))
     ;; Don't move past the fill column.
@@ -698,7 +697,8 @@
 	  (save-excursion
 	    (skip-chars-backward " \t")
 	    (unless (bolp)
-	      (setq indent (max indent (+ (current-column) comment-inline-offset)))))
+	      (setq indent (max indent
+                                (+ (current-column) comment-inline-offset)))))
 	  ;; If that's different from comment's current position, change it.
 	  (unless (= (current-column) indent)
 	    (delete-region (point) (progn (skip-chars-backward " \t") (point)))





This bug report was last modified 13 years and 56 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.