GNU bug report logs - #77335
30.1; RefTeX: Move some 'setq' expressions out of loop

Previous Next

Package: emacs;

Reported by: Pengji Zhang <me <at> pengjiz.com>

Date: Fri, 28 Mar 2025 10:43:02 UTC

Severity: normal

Found in version 30.1

Done: Arash Esbati <arash <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Pengji Zhang <me <at> pengjiz.com>
Subject: bug#77335: closed (Re: bug#77335: 30.1; RefTeX: Move some 'setq'
 expressions out of loop)
Date: Mon, 14 Jul 2025 19:52:02 +0000
[Message part 1 (text/plain, inline)]
Your bug report

#77335: 30.1; RefTeX: Move some 'setq' expressions out of loop

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to 77335 <at> debbugs.gnu.org.

-- 
77335: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=77335
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Arash Esbati <arash <at> gnu.org>
To: Pengji Zhang <me <at> pengjiz.com>
Cc: 77335-done <at> debbugs.gnu.org
Subject: Re: bug#77335: 30.1; RefTeX: Move some 'setq' expressions out of loop
Date: Mon, 14 Jul 2025 21:51:38 +0200
Pengji Zhang <me <at> pengjiz.com> writes:

> (I am not sure if this is the right list to submit a patch for RefTeX.
> Please let me know if it is not. Thanks!)

I'd say here or bug-auctex <at> gnu.org should work.

> In the function 'reftex-offer-label-menu', there are two 'setq'
> expressions inside a loop. That makes it hard for users to change those
> settings. For example, I would like to remove 'global-mode-string' from
> the mode line of the label buffer, but there is no easy way to do so.
>
> This patch moves the two 'setq' expressions to the definition of the
> major mode for the buffer, so users could use the mode hook to tweak
> those two settings.

I installed your patch (commit 5d9a67e4).  My apologies it took so long;
I managed to miss this report which I'm now closing.

Best, Arash

[Message part 3 (message/rfc822, inline)]
From: Pengji Zhang <me <at> pengjiz.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 30.1; RefTeX: Move some 'setq' expressions out of loop
Date: Fri, 28 Mar 2025 18:42:22 +0800
[Message part 4 (text/plain, inline)]
Hello,

(I am not sure if this is the right list to submit a patch for RefTeX.
Please let me know if it is not. Thanks!)

In the function 'reftex-offer-label-menu', there are two 'setq'
expressions inside a loop. That makes it hard for users to change those
settings. For example, I would like to remove 'global-mode-string' from
the mode line of the label buffer, but there is no easy way to do so.

This patch moves the two 'setq' expressions to the definition of the
major mode for the buffer, so users could use the mode hook to tweak
those two settings.

Thanks!

[0001-Move-some-RefTeX-setq-s-to-major-mode-definition.patch (text/x-patch, inline)]
From 6a73bba1a2954daabe728e007eb55e839993e1d8 Mon Sep 17 00:00:00 2001
From: Pengji Zhang <me <at> pengjiz.com>
Date: Sun, 23 Mar 2025 11:48:14 +0800
Subject: [PATCH] Move some RefTeX 'setq's to major mode definition

Move two 'setq' expressions from the RefTeX label selection loop
to the body of the major mode definition, so to make it easier
to adjust the settings of the buffer via the mode hook.

* lisp/textmodes/reftex-ref.el (reftex-offer-label-menu): Move
two 'setq' expressions from here...
* lisp/textmodes/reftex-sel.el (reftex-select-label-mode): ...to
here.
---
 lisp/textmodes/reftex-ref.el | 6 ------
 lisp/textmodes/reftex-sel.el | 6 ++++++
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/lisp/textmodes/reftex-ref.el b/lisp/textmodes/reftex-ref.el
index 30e9968a8e5..cac5ad65e86 100644
--- a/lisp/textmodes/reftex-ref.el
+++ b/lisp/textmodes/reftex-ref.el
@@ -569,12 +569,6 @@ reftex-offer-label-menu
               (unless (eq major-mode 'reftex-select-label-mode)
                 (reftex-select-label-mode))
               (cl-pushnew (current-buffer) selection-buffers)
-              (setq truncate-lines t)
-              (setq mode-line-format
-                    (list "----  " 'mode-line-buffer-identification
-                          "  " 'global-mode-string "   (" mode-name ")"
-                          "  S<" 'reftex-refstyle ">"
-                          " -%-"))
               (cond
                ((= 0 (buffer-size))
                 (let ((buffer-read-only nil))
diff --git a/lisp/textmodes/reftex-sel.el b/lisp/textmodes/reftex-sel.el
index 1f1c74550a5..4fbbb1fdeb0 100644
--- a/lisp/textmodes/reftex-sel.el
+++ b/lisp/textmodes/reftex-sel.el
@@ -98,6 +98,12 @@ reftex-select-label-mode
 
 \\{reftex-select-label-mode-map}"
   (setq-local reftex-select-marked nil)
+  (setq truncate-lines t)
+  (setq mode-line-format
+        (list "----  " 'mode-line-buffer-identification
+              "  " 'global-mode-string "   (" mode-name ")"
+              "  S<" 'reftex-refstyle ">"
+              " -%-"))
   (when (syntax-table-p reftex-latex-syntax-table)
     (set-syntax-table reftex-latex-syntax-table))
   ;; We do not set a local map - reftex-select-item does this.
-- 
2.49.0


This bug report was last modified 2 days ago.

Previous Next


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