GNU bug report logs - #8539
default value of Buffer-menu-buffer-column hard-coded in places

Previous Next

Package: emacs;

Reported by: Alp Aker <aker <at> pitt.edu>

Date: Sat, 23 Apr 2011 02:44:01 UTC

Severity: minor

Done: Chong Yidong <cyd <at> stupidchicken.com>

Bug is archived. No further changes may be made.

Full log


Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Alp Aker <aker <at> pitt.edu>
To: bug-gnu-emacs <at> gnu.org
Subject: default value of Buffer-menu-buffer-column hard-coded in places
Date: Fri, 22 Apr 2011 22:42:49 -0400 (EDT)
Buffer-menu-buffer-column's default value of 4 is hard-coded into several 
functions from buff-menu.el.  As of 24.0.50, this is true of 
Buffer-menu-sort and Buffer-menu-revert-function.

This is not strictly speaking a bug, but it is an anti-pattern, and it can 
unexpectedly bite someone hacking on buff-menu.el.  So it would perhaps be 
good practice to make the following changes:

=== modified file 'lisp/buff-menu.el'
--- lisp/buff-menu.el	2011-04-19 13:44:55 +0000
+++ lisp/buff-menu.el	2011-04-23 02:30:41 +0000
@@ -278,7 +278,7 @@
   (let ((opoint (point))
 	(eobp (eobp))
 	(ocol (current-column))
-	(oline (progn (move-to-column 4)
+	(oline (progn (move-to-column Buffer-menu-buffer-column)
 		      (get-text-property (point) 'buffer)))
 	(prop (point-min))
 	;; do not make undo records for the reversion.
@@ -703,7 +703,7 @@
     (save-excursion
       (Buffer-menu-beginning)
       (while (not (eobp))
-	(when (buffer-live-p (setq buf (get-text-property (+ (point) 4) 'buffer)))
+	(when (buffer-live-p (setq buf (get-text-property (+ (point) Buffer-menu-buffer-column) 'buffer)))
 	  (setq m1 (char-after)
 		m1 (if (memq m1 '(?> ?D)) m1)
 		m2 (char-after (+ (point) 2))
@@ -715,7 +715,7 @@
     (save-excursion
       (Buffer-menu-beginning)
       (while (not (eobp))
-	(when (setq buf (assq (get-text-property (+ (point) 4) 'buffer) l))
+	(when (setq buf (assq (get-text-property (+ (point) Buffer-menu-buffer-column) 'buffer) l))
 	  (setq m1 (cadr buf)
 		m2 (cadr (cdr buf)))
 	  (when m1




This bug report was last modified 14 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.