unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#8539: default value of Buffer-menu-buffer-column hard-coded in places
@ 2011-04-23  2:42 Alp Aker
  2011-05-28 19:13 ` Chong Yidong
  0 siblings, 1 reply; 4+ messages in thread
From: Alp Aker @ 2011-04-23  2:42 UTC (permalink / raw)
  To: 8539

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





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

* bug#8539: default value of Buffer-menu-buffer-column hard-coded in places
  2011-04-23  2:42 bug#8539: default value of Buffer-menu-buffer-column hard-coded in places Alp Aker
@ 2011-05-28 19:13 ` Chong Yidong
  2011-05-28 19:40   ` Alp Aker
  0 siblings, 1 reply; 4+ messages in thread
From: Chong Yidong @ 2011-05-28 19:13 UTC (permalink / raw)
  To: Alp Aker; +Cc: 8539

Alp Aker <aker@pitt.edu> writes:

> 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.

Thanks, committed.





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

* bug#8539: default value of Buffer-menu-buffer-column hard-coded in places
  2011-05-28 19:13 ` Chong Yidong
@ 2011-05-28 19:40   ` Alp Aker
  2011-05-28 20:08     ` Chong Yidong
  0 siblings, 1 reply; 4+ messages in thread
From: Alp Aker @ 2011-05-28 19:40 UTC (permalink / raw)
  To: Chong Yidong; +Cc: 8539

Just a quick follow-up:  After posting the bug report I noticed the same 
problem in Buffer-menu-buffer+size.  In the display spec

   (space :align-to ,(+ 4 name+space-width)

at the end of the function, that "4" should also be replaced with 
"Buffer-menu-buffer-column".

On Sat, 28 May 2011, Chong Yidong wrote:

> Alp Aker <aker@pitt.edu> writes:
>
>> 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.
>
> Thanks, committed.
>





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

* bug#8539: default value of Buffer-menu-buffer-column hard-coded in places
  2011-05-28 19:40   ` Alp Aker
@ 2011-05-28 20:08     ` Chong Yidong
  0 siblings, 0 replies; 4+ messages in thread
From: Chong Yidong @ 2011-05-28 20:08 UTC (permalink / raw)
  To: Alp Aker; +Cc: 8539

Alp Aker <aker@pitt.edu> writes:

> Just a quick follow-up:  After posting the bug report I noticed the
> same problem in Buffer-menu-buffer+size.  In the display spec
>
>   (space :align-to ,(+ 4 name+space-width)
>
> at the end of the function, that "4" should also be replaced with
> "Buffer-menu-buffer-column".

Thanks, applied.





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

end of thread, other threads:[~2011-05-28 20:08 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-04-23  2:42 bug#8539: default value of Buffer-menu-buffer-column hard-coded in places Alp Aker
2011-05-28 19:13 ` Chong Yidong
2011-05-28 19:40   ` Alp Aker
2011-05-28 20:08     ` Chong Yidong

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