bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#8539: default value of Buffer-menu-buffer-column hard-coded in place


From: Alp Aker
Subject: bug#8539: 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





reply via email to

[Prev in Thread] Current Thread [Next in Thread]