all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#72138: 30.0.50; [PATCH] Fix ring size in comint-read-input-ring
@ 2024-07-16 10:10 Liu Hui
  2024-07-27  7:13 ` Eli Zaretskii
  0 siblings, 1 reply; 2+ messages in thread
From: Liu Hui @ 2024-07-16 10:10 UTC (permalink / raw)
  To: 72138

[-- Attachment #1: Type: text/plain, Size: 463 bytes --]

Hi,

When comint-read-input-ring reads history to the ring, the global
value of comint-input-ring-size (i.e. 500) is used regardless of the
local value due to the use of temp buffer. For example:

1. HISTSIZE=10 emacs -Q
2. M-x shell

The buffer-local value of comint-input-ring-size is correctly set to
10, but C-c C-l shows 500 commands.

The attached patch fixes the problem that comint-read-input-ring
ignores the buffer-local comint-input-ring-size. Thanks.

[-- Attachment #2: 0001-lisp-comint.el-comint-read-input-ring-Fix-ring-size.patch --]
[-- Type: text/x-patch, Size: 1766 bytes --]

From 50f4e7e349693dfb72e4dba23ec69efdb90b7eab Mon Sep 17 00:00:00 2001
From: Liu Hui <liuhui1610@gmail.com>
Date: Tue, 16 Jul 2024 18:05:46 +0800
Subject: [PATCH] * lisp/comint.el (comint-read-input-ring): Fix ring size.

---
 lisp/comint.el | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/lisp/comint.el b/lisp/comint.el
index 29d2c429717..35b18edec66 100644
--- a/lisp/comint.el
+++ b/lisp/comint.el
@@ -1060,6 +1060,7 @@ comint-read-input-ring
 		(ring-size (min 1500 comint-input-ring-size))
 		(ring (make-ring ring-size))
                 ;; Use possibly buffer-local values of these variables.
+                (ring-max-size comint-input-ring-size)
                 (ring-separator comint-input-ring-separator)
                 (ring-file-prefix comint-input-ring-file-prefix)
                 (history-ignore comint-input-history-ignore)
@@ -1070,7 +1071,7 @@ comint-read-input-ring
              ;; Watch for those date stamps in history files!
              (goto-char (point-max))
              (let (start end history)
-               (while (and (< count comint-input-ring-size)
+               (while (and (< count ring-max-size)
                            (re-search-backward ring-separator nil t)
                            (setq end (match-beginning 0)))
                  (goto-char (if (re-search-backward ring-separator nil t)
@@ -1088,7 +1089,7 @@ comint-read-input-ring
 				(not (string-equal (ring-ref ring 0)
 						   history))))
 		   (when (= count ring-size)
-		     (ring-extend ring (min (- comint-input-ring-size ring-size)
+		     (ring-extend ring (min (- ring-max-size ring-size)
 					    ring-size))
 		     (setq ring-size (ring-size ring)))
 		   (ring-insert-at-beginning ring history)
-- 
2.25.1


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

* bug#72138: 30.0.50; [PATCH] Fix ring size in comint-read-input-ring
  2024-07-16 10:10 bug#72138: 30.0.50; [PATCH] Fix ring size in comint-read-input-ring Liu Hui
@ 2024-07-27  7:13 ` Eli Zaretskii
  0 siblings, 0 replies; 2+ messages in thread
From: Eli Zaretskii @ 2024-07-27  7:13 UTC (permalink / raw)
  To: Liu Hui; +Cc: 72138-done

> From: Liu Hui <liuhui1610@gmail.com>
> Date: Tue, 16 Jul 2024 18:10:00 +0800
> 
> When comint-read-input-ring reads history to the ring, the global
> value of comint-input-ring-size (i.e. 500) is used regardless of the
> local value due to the use of temp buffer. For example:
> 
> 1. HISTSIZE=10 emacs -Q
> 2. M-x shell
> 
> The buffer-local value of comint-input-ring-size is correctly set to
> 10, but C-c C-l shows 500 commands.
> 
> The attached patch fixes the problem that comint-read-input-ring
> ignores the buffer-local comint-input-ring-size. Thanks.

Thanks, installed on the master branch, and closing the bug.





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

end of thread, other threads:[~2024-07-27  7:13 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-16 10:10 bug#72138: 30.0.50; [PATCH] Fix ring size in comint-read-input-ring Liu Hui
2024-07-27  7:13 ` Eli Zaretskii

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.