X-Loop: help-debbugs@HIDDEN Subject: bug#76789: 31.0.50; [PATCH] speedbar: New speedbar-window-mode Resent-From: Vincenzo Pupillo <v.pupillo@HIDDEN> Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> Resent-CC: bug-gnu-emacs@HIDDEN Resent-Date: Thu, 06 Mar 2025 20:43:01 +0000 Resent-Message-ID: <handler.76789.B.174129375428992 <at> debbugs.gnu.org> Resent-Sender: help-debbugs@HIDDEN X-GNU-PR-Message: report 76789 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: 76789 <at> debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@HIDDEN Received: via spool by submit <at> debbugs.gnu.org id=B.174129375428992 (code B ref -1); Thu, 06 Mar 2025 20:43:01 +0000 Received: (at submit) by debbugs.gnu.org; 6 Mar 2025 20:42:34 +0000 Received: from localhost ([127.0.0.1]:45608 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1tqI37-0007XW-6f for submit <at> debbugs.gnu.org; Thu, 06 Mar 2025 15:42:34 -0500 Received: from lists.gnu.org ([2001:470:142::17]:35370) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from <v.pupillo@HIDDEN>) id 1tqI33-0007XI-AX for submit <at> debbugs.gnu.org; Thu, 06 Mar 2025 15:42:31 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <v.pupillo@HIDDEN>) id 1tqI2w-0001WQ-VU for bug-gnu-emacs@HIDDEN; Thu, 06 Mar 2025 15:42:23 -0500 Received: from mail-ed1-x52e.google.com ([2a00:1450:4864:20::52e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from <v.pupillo@HIDDEN>) id 1tqI2s-0004Is-L6 for bug-gnu-emacs@HIDDEN; Thu, 06 Mar 2025 15:42:22 -0500 Received: by mail-ed1-x52e.google.com with SMTP id 4fb4d7f45d1cf-5e095d47a25so2061314a12.0 for <bug-gnu-emacs@HIDDEN>; Thu, 06 Mar 2025 12:42:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1741293734; x=1741898534; darn=gnu.org; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:from:to:cc:subject:date:message-id:reply-to; bh=/Dr1mBVI5D/OctWdeokFpeVFuMILhT7QmxGlvzeth+8=; b=WccU2GS78E3sjW1PkYlVkGN5dC03TzbqD+ShZZmrTCGYypKKsTWWcb2QwkY6//vJ8W KrF0AGi3fTwfhaFQInLDC2GPQ5aFIJtx90W9RyAn5qm68Pg/pYm2/wB6kaENStriyvjN 2TBFVUJ4Rd+OSOFy2fFBm0OwxdUQrACP6FF73aDBUIHiAwyDhirsDO6cNf90r+fuaF8V IAvQjouc6uGAItmBGe9sc0hW1xB4D0k4MRH0Wx1Rf8BBaP1qrrfUGRJduZsRMSZ0pROX ItdQ64GnZncqcq/AdRzqN+7TVDc5BiieRELAOvAbjAO4znOQ+Mr7UE4bQJoeizRNzh03 +tcg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1741293734; x=1741898534; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=/Dr1mBVI5D/OctWdeokFpeVFuMILhT7QmxGlvzeth+8=; b=CAmnaIMKxe+SWJJ9Fz5/i/GPTIC2v/UCFvHQ8kv0sLdpQ/+89u7NE5oEkmTbaMTUgD JvkXXRhyC74MRXrfU8KBRK3zjTqyzDSPEVC+i+xYuq52xziJZFeDpCNQ7asfYeUo7uSC UfJcL4s/keLheBe7pZUagOIUBnQRrSuZihMzg8BfNkUOTs66qiuogd+cFTDqSqLdL0YL QhR4Hungm4Wr1F4Kzb6Dxmkhg4qYO7AihwAwD5TOBC0+df27NQNzrkQBNtLn29v+TKp5 g3U0TsQHZ7pu+1re7Zm9941E1V0RxEp1Aj4YNQIJ5i77XuTp0aHe1pBS6g/202Kt2Q5Y Unyw== X-Gm-Message-State: AOJu0YysHokQiWUAcozRTkNHFwrP/LquS2bSJMbwblX7dA5V3zI+KV79 AonPKEXECqGrkygAUxbzKC5SXW6rAYmlpgWH9XLZjtRup6PnwkPBMP1TjQ== X-Gm-Gg: ASbGnctgjB21oclgCFgEM7nb128fHooQ3c40TSkvoZ5t0/8S5KAR/xc9MLb8XhKlCGT rYTQv4v7xN3GTSp0XcVG0NXsm5wNYGRQ5h1Ak/E2CqVr8M65CG17SQvNkq181b23lMEfs6Aj+GI lTPC3w+7CaZicilanaZJQKFLgcGP3VRltqimj+8CYXfTlw7+pKWPnOhD2uyEwyKLYkCdQBBonSZ kZYVCfNxU343NACl1F1bytVRE0qh+z0xcKOuyptQdZyV1bdBgvrubpQ/d88RtGMBxWBK7hDwIId 5yg+jcdJ10jFY/8cKi4319o7Wb2Q1Bd3rnyy+0lsMrHLSVhqTUeOB+c40FEdd79hu1axNf+nM/a IwqbDUtyZ X-Google-Smtp-Source: AGHT+IGdxl2Gfc1gGxhv7kQKVDjmK77xsiQnvtjke0vw5OKbTMPqypGyTvULU1KPSjJeWdvIelF7/w== X-Received: by 2002:a05:6402:84f:b0:5e5:966b:d3ef with SMTP id 4fb4d7f45d1cf-5e5e22d5743mr628396a12.16.1741293733827; Thu, 06 Mar 2025 12:42:13 -0800 (PST) Received: from fedora.localnet (2-230-139-124.ip202.fastwebnet.it. [2.230.139.124]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5e5c74a8608sm1422624a12.38.2025.03.06.12.42.13 for <bug-gnu-emacs@HIDDEN> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Mar 2025 12:42:13 -0800 (PST) From: Vincenzo Pupillo <v.pupillo@HIDDEN> Date: Thu, 06 Mar 2025 21:42:12 +0100 Message-ID: <5658405.rdbgypaU67@fedora> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="nextPart3515526.LZWGnKmheA" Content-Transfer-Encoding: 7Bit Received-SPF: pass client-ip=2a00:1450:4864:20::52e; envelope-from=v.pupillo@HIDDEN; helo=mail-ed1-x52e.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: 1.0 (+) X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -0.0 (/) This is a multi-part message in MIME format. --nextPart3515526.LZWGnKmheA Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="utf-8" Ciao, this patch adds speedbar-window-mode as an alternative to the default speedbar-frame-mode. Calling speedbar-window-mode will close speedbar-frame- mode if it is open, and vice versa. speedbar-window-mode, thanks to display-buffer-in-side-window, can be placed on the left side, right side but also on the top or bottom. Thank you. Vincenzo --nextPart3515526.LZWGnKmheA Content-Disposition: attachment; filename="0001-Add-a-new-command-speedbar-window.patch" Content-Transfer-Encoding: 7Bit Content-Type: text/x-patch; charset="UTF-8"; name="0001-Add-a-new-command-speedbar-window.patch" From c750a17e6d6707e912bb463d10271c2b9ed80ce7 Mon Sep 17 00:00:00 2001 From: Vincenzo Pupillo <vincenzo.pupillo@HIDDEN> Date: Thu, 6 Mar 2025 13:39:01 +0100 Subject: [PATCH] Add a new command `speedbar-window'. Speedbar now can be opened in a window instead of a frame. The frame remains the default. * lisp/speedbar.el (speedbar-prefer-window): New user option. If t, the command `speedbar' open the speedbar in a window. (speedbar-window-dedicated-window): New user option. If t the window is dedicated. (speedbar-window-side): New user option. The side of 'speedbar-window', defaults to left. (speedbar-window-default-width): New user option. The default size of the 'speedbar-window'. (speedbar-window-max-width): New user option. Limits the width of the 'speedbar-window'. The user can resize the window as desired, but this option will be the width of the window when restored. (speedbar--buffer-name): New variable, the buffer name used for both 'speedbar-frame-mode' and 'speedbar-window-mode'. (speedbar--window): New variable, the window displaying 'speedbar-window'. (speedbar--window-width): New variable, store the current width of 'speedbar-window'. (speedbar): Now it is a function that calls 'speedbar-frame-mode', the default or 'speedbar-window-mode' based on the value of 'speedbar-prefer-window'. (speedbar-frame-mode): Before opening a frame, close 'speedbar-window' if it is open. (speedbar-is-frame-or-window-p): New function, returns 'frame', 'window' or nil if speedbar is not open. (speedbar-window): New alias for 'speedbar-window-mode'. (speedbar-window-mode): Enable of disable 'speedbar-window'. (speedbar-window--window-live-p): New function, return non-nil if the 'speedbar-window' is live. (speedbar-window--buffer-live-p): New function, return non-nil if the 'speedbar-buffer' is live. (speedbar-window--live-p): New function, return t if 'speedbar-window' is open. (speedbar-window-current-window): New function, return t if the selected window is speedbar-window. (speedbar-window--close): New function, close the 'speedbar-window'. (speedbar-window--width): New function, return the current width of 'speedbar-window'. (speedbar-width): New function, return the 'speedbar' of 'speedbar-frame-mode' of 'speedbar-frame-mode'. (speedbar-set-mode-line-format): Use the new 'speedbar-width' function. (speedbar-directory-buttons): Use the new 'speedbar-width' function. (speedbar--speedbar-live-p): New function, returns t if 'speedbar-frame-mode' or 'speedbar-window-mode' are open. (speedbar-timer-fn): Now handle 'speedbar-frame-mode' and 'speedbar-window-mode'. --- etc/NEWS | 9 ++ lisp/speedbar.el | 276 +++++++++++++++++++++++++++++++++++++++-------- 2 files changed, 239 insertions(+), 46 deletions(-) diff --git a/etc/NEWS b/etc/NEWS index ef4cacb20f9..5c6c48f87b4 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -1375,6 +1375,15 @@ Major-mode authors can customize the variables 'yank-media-autoselect-function' and/or 'yank-media-preferred-types' to change the selection rules. +** Speedbar + +--- +*** The new command 'speedbar-window' open Speedbar in a window instead +of a frame. + +*** The new user option 'speedbar-prefer-window', tell 'speedbar' to open +a side window instead of a frame. + ** Miscellaneous --- diff --git a/lisp/speedbar.el b/lisp/speedbar.el index 104e23b9bc9..4ba3d624afe 100644 --- a/lisp/speedbar.el +++ b/lisp/speedbar.el @@ -22,9 +22,9 @@ ;;; Commentary: ;; -;; The speedbar provides a frame in which files, and locations in -;; files are displayed. These items can be clicked on with mouse-2 in -;; to display that file location. +;; The speedbar provides a frame or a window in which files, and +;; locations in files are displayed. These items can be clicked on with +;; mouse-2 in to display that file location. ;; ;;; Customizing and Developing for speedbar ;; @@ -139,8 +139,53 @@ speedbar-use-images :version "21.1" :type 'boolean) +(defcustom speedbar-prefer-window nil + "If t, the command `speedbar' open the speedbar in a window." + :type 'boolean + :group 'speedbar + :version "31.1") + +(defcustom speedbar-window-dedicated-window t + "Make the `speedbar-window' dedicated." + :group 'speedbar + :type 'boolean + :version "31.1") + +(defcustom speedbar-window-side 'left + "Show the `speedbar-window' on the `left', `right', `top' or `bottom'. +See `display-buffer-in-side-window' for more details." + :type '(radio (const :tag "Left" left) + (const :tag "Right" right) + (const :tag "Top" top) + (const :tag "Bottom" bottom)) + :group 'speedbar + :version "31.1") + +(defcustom speedbar-window-default-width 20 + "Initial width of `speedbar-window' under window system. +The default value is the same width of `speedbar-frame-mode'." + :type 'integer + :group 'speedbar + :version "31.1") + +(defcustom speedbar-window-max-width 40 + "The maximum allowed `speedbar-window' width limit." + :type 'integer + :group 'speedbar + :version "31.1") + ;;; Code: +(defconst speedbar--buffer-name " SPEEDBAR" + "Speedbar buffer name.") + +(defvar speedbar--window nil + "The window displaying `speedbar-window'.") + +(defvar speedbar--window-width speedbar-window-default-width +"Stores the current width of `speedbar-window'. +Subsequent calls to `speedbar-window' will open a window of this width.") + (defvar speedbar-initial-expansion-mode-alist '(("buffers" speedbar-buffer-easymenu-definition speedbar-buffers-key-map speedbar-buffer-buttons) @@ -891,7 +936,18 @@ 'speedbar-mode-line-update ;; ;;;###autoload -(defalias 'speedbar 'speedbar-frame-mode) +(defun speedbar (&optional arg) + "Open or close the `speedbar'. Positive ARG means turn on, negative turn off. +A nil ARG means toggle. When `speedbar-prefer-window' open the +speedbar in a window istead of in a frame." + (interactive "P") + (if speedbar-prefer-window + (speedbar-window-mode arg) + (speedbar-frame-mode arg))) + +;;;###autoload +(defalias 'speedbar-frame 'speedbar-frame-mode) + ;;;###autoload (defun speedbar-frame-mode (&optional arg) "Enable or disable speedbar. Positive ARG means turn on, negative turn off. @@ -901,10 +957,12 @@ speedbar-frame-mode `speedbar-before-popup-hook' is called before popping up the speedbar frame. `speedbar-before-delete-hook' is called before the frame is deleted." (interactive "P") + (when (eq (speedbar-is-frame-or-window-p) 'window) + (speedbar-window--close)) ;; Get the buffer to play with (if (not (buffer-live-p speedbar-buffer)) (with-current-buffer - (setq speedbar-buffer (get-buffer-create " SPEEDBAR")) + (setq speedbar-buffer (get-buffer-create speedbar--buffer-name)) (speedbar-mode))) ;; Do the frame thing (dframe-frame-mode arg @@ -934,6 +992,113 @@ speedbar-frame-mode (message (substitute-command-keys "Use \\[speedbar-get-focus] to see the speedbar window")))) +(defun speedbar-is-frame-or-window-p () + "Return 'frame' of 'window' if one of each are open. +Return nil if both are closed." + (cond + ((speedbar-window--live-p) + 'window) + ((and (frame-live-p (speedbar-current-frame)) + speedbar-buffer + (not (speedbar-window--live-p))) + 'frame) + (t nil))) + +;;;###autoload +(defalias 'speedbar-window 'speedbar-window-mode) +;;;###autoload +(defun speedbar-window-mode (&optional arg) + "Enable or disable speedbar window. +Positive ARG means turn on, negative turn off. +A nil ARG means toggle. Once the speedbar window is activated, a buffer in +`speedbar-mode' will be displayed. Currently, only one speedbar is +supported at a time. +`speedbar-before-popup-hook' is called before popping up the speedbar frame. +`speedbar-before-delete-hook' is called before the frame is deleted." + (interactive "P") + (when (eq (speedbar-is-frame-or-window-p) 'frame) + (delete-frame (speedbar-current-frame))) + + (if (or (and (not arg) (speedbar-window--live-p)) + (and (numberp arg) (< arg 0))) + (speedbar-window--close) + (let ((current-window (selected-window))) + (unless (speedbar-window--buffer-live-p) + (setq speedbar-buffer (get-buffer-create speedbar--buffer-name))) + + (setq speedbar-frame (selected-frame) + dframe-attached-frame (selected-frame) + speedbar-select-frame-method 'attached + speedbar-last-selected-file nil) + + (set-buffer speedbar-buffer) + (speedbar-mode) + (speedbar-reconfigure-keymaps) + (speedbar-update-contents) + + ;; let's create the window + (setq speedbar--window + (display-buffer-in-side-window speedbar-buffer + `((side ,@speedbar-window-side) + (slot . 0) + (dedicated ,@speedbar-window-dedicated-window) + (window-width ,@speedbar--window-width)))) + ;; additional window parameters + (set-window-parameter speedbar--window 'no-other-window t) + (set-window-parameter speedbar--window 'no-delete-other-windows t) + + (speedbar-set-timer dframe-update-speed) + + ;; hscroll + (setq-local auto-hscroll-mode nil) + ;; reset the selection variable + (setq speedbar-last-selected-file nil) + (select-window current-window)))) + +(defsubst speedbar-window--window-live-p () + "Return non-nil if `speedbar--window' is defined and live." + (when (and speedbar--window (window-live-p speedbar--window)) + speedbar--window)) + +(defsubst speedbar-window--buffer-live-p () + "Return non-nil `speedbar-buffer' is defined and live." + (when (and speedbar-buffer (buffer-live-p speedbar-buffer)) + speedbar-buffer)) + +(defun speedbar-window--live-p () + "Return t if `speedbar-window' is opened." + (and (speedbar-window--buffer-live-p) (speedbar-window--window-live-p))) + +(defsubst speedbar-window-current-window () + "Return t if the current windows is the `speedbar--window'." + (eq (selected-window) speedbar--window)) + +(defun speedbar-window--close () + "Close `speedbar-window'." + (when (speedbar-window--live-p) + (let ((current-window (selected-window))) + ;; store the current window width + (setq speedbar--window-width + (let ((current-width (speedbar-window--width))) + (if (> current-width speedbar-window-max-width) + speedbar-window-max-width + current-width))) + + (delete-window speedbar--window) + (setq speedbar--window nil + speedbar-frame nil + dframe-attached-frame nil) + (speedbar-set-timer nil) + (kill-buffer speedbar-buffer) + (setq speedbar-buffer nil) + (when (and current-window (window-live-p current-window)) + (select-window current-window))))) + +(defsubst speedbar-window--width () + "Return the width of `speedbar-window' WINDOW." + (let ((edges (window-edges speedbar--window))) + (- (nth 2 edges) (nth 0 edges)))) + (defun speedbar-frame-reposition-smartly () "Reposition the speedbar frame to be next to the attached frame." (cond ((or (assoc 'left speedbar-frame-parameters) @@ -980,6 +1145,14 @@ speedbar-frame-width Return nil if it doesn't exist." (frame-width speedbar-frame)) +(defun speedbar-width () + "Returns the width of the `speedbar'. +if `speedbar-window-mode' is open, the width is `speedbar-window--width' +otherwise the width is `speedbar-frame-width'." + (if (speedbar-window--live-p) + (speedbar-window--width) + (speedbar-frame-width))) + (define-derived-mode speedbar-mode fundamental-mode "Speedbar" "Major mode for managing a display of directories and tags. \\<speedbar-mode-map> @@ -1066,7 +1239,7 @@ speedbar-set-mode-line-format (if (and (frame-live-p (speedbar-current-frame)) speedbar-buffer) (with-current-buffer speedbar-buffer - (let* ((w (or (speedbar-frame-width) 20)) + (let* ((w (or (speedbar-width) 20)) (p1 "<<") (p5 ">>") (p3 (if speedbar-update-flag "#" "!")) @@ -1838,7 +2011,7 @@ speedbar-directory-buttons ;; Nuke the beginning of the directory if it's too long... (cond ((eq speedbar-directory-button-trim-method 'span) (beginning-of-line) - (let ((ww (or (speedbar-frame-width) 20))) + (let ((ww (or (speedbar-width) 20))) (move-to-column ww nil) (while (>= (current-column) ww) (re-search-backward "[/\\]" nil t) @@ -1854,7 +2027,7 @@ speedbar-directory-buttons (move-to-column ww nil))))) ((eq speedbar-directory-button-trim-method 'trim) (end-of-line) - (let ((ww (or (speedbar-frame-width) 20)) + (let ((ww (or (speedbar-width) 20)) (tl (current-column))) (if (< ww tl) (progn @@ -2525,56 +2698,67 @@ speedbar-set-timer ;; change this if it changed for some reason (speedbar-set-mode-line-format)) +(defun speedbar--speedbar-live-p () + "Return non-nil if `speedbar-window-mode' or `speedbar-frame-mode' are open." + (cond + ((and (speedbar-current-frame) + (frame-live-p (speedbar-current-frame))) + t) + ((speedbar-window--window-live-p) t) + (t nil))) + (defun speedbar-timer-fn () "Run whenever Emacs is idle to update the speedbar item." - (if (or (not (speedbar-current-frame)) - (not (frame-live-p (speedbar-current-frame)))) + (if (not (speedbar--speedbar-live-p)) (speedbar-set-timer nil) ;; Save all the match data so that we don't mess up executing fns (save-match-data ;; Only do stuff if the frame is visible, not an icon, and if ;; it is currently flagged to do something. (if (and speedbar-update-flag - (speedbar-current-frame) + (or (speedbar-window-current-window) + (speedbar-current-frame)) (frame-visible-p (speedbar-current-frame)) (not (eq (frame-visible-p (speedbar-current-frame)) 'icon))) (let ((af (selected-frame))) - (dframe-select-attached-frame speedbar-frame) - ;; make sure we at least choose a window to - ;; get a good directory from - (if (window-minibuffer-p) - nil - ;; Check for special modes - (speedbar-maybe-add-localized-support (current-buffer)) - ;; Update for special mode all the time! - (if (and speedbar-mode-specific-contents-flag - (consp speedbar-special-mode-expansion-list) - (local-variable-p - 'speedbar-special-mode-expansion-list - (current-buffer))) - ;;(eq (get major-mode 'mode-class 'special))) - (progn - (if (<= 2 speedbar-verbosity-level) + (dframe-select-attached-frame speedbar-frame) + ;; make sure we at least choose a window to + ;; get a good directory from + (if (window-minibuffer-p) + nil + ;; Check for special modes + (speedbar-maybe-add-localized-support (current-buffer)) + ;; Update for special mode all the time! + (if (and speedbar-mode-specific-contents-flag + (consp speedbar-special-mode-expansion-list) + (local-variable-p + 'speedbar-special-mode-expansion-list + (current-buffer))) + ;;(eq (get major-mode 'mode-class 'special))) + (progn + (if (<= 2 speedbar-verbosity-level) + (dframe-message + "Updating speedbar to special mode: %s..." + major-mode)) + (speedbar-update-special-contents) + (if (<= 2 speedbar-verbosity-level) + (progn (dframe-message - "Updating speedbar to special mode: %s..." - major-mode)) - (speedbar-update-special-contents) - (if (<= 2 speedbar-verbosity-level) - (progn - (dframe-message - "Updating speedbar to special mode: %s...done" - major-mode) - (dframe-message nil)))) - - ;; Update all the contents if directories change! - (unless (and (or (member major-mode speedbar-ignored-modes) - (eq af (speedbar-current-frame)) - (not (buffer-file-name))) - ;; Always update for GUD. - (not (string-equal "GUD" - speedbar-initial-expansion-list-name))) - (speedbar-update-localized-contents))) - (select-frame af)) + "Updating speedbar to special mode: %s...done" + major-mode) + (dframe-message nil)))) + + ;; Update all the contents if directories change! + (unless (and (or (member major-mode speedbar-ignored-modes) + (and + (eq af (speedbar-current-frame)) + (speedbar-window-current-window)) + (not (buffer-file-name))) + ;; Always update for GUD. + (not (string-equal "GUD" + speedbar-initial-expansion-list-name))) + (speedbar-update-localized-contents))) + (select-frame af)) ;; Now run stealthy updates of time-consuming items (speedbar-stealthy-updates))))) (run-hooks 'speedbar-timer-hook)) -- 2.48.1 --nextPart3515526.LZWGnKmheA--
Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) Content-Type: text/plain; charset=utf-8 X-Loop: help-debbugs@HIDDEN From: help-debbugs@HIDDEN (GNU bug Tracking System) To: Vincenzo Pupillo <v.pupillo@HIDDEN> Subject: bug#76789: Acknowledgement (31.0.50; [PATCH] speedbar: New speedbar-window-mode) Message-ID: <handler.76789.B.174129375428992.ack <at> debbugs.gnu.org> References: <5658405.rdbgypaU67@fedora> X-Gnu-PR-Message: ack 76789 X-Gnu-PR-Package: emacs X-Gnu-PR-Keywords: patch Reply-To: 76789 <at> debbugs.gnu.org Date: Thu, 06 Mar 2025 20:43:02 +0000 Thank you for filing a new bug report with debbugs.gnu.org. This is an automatically generated reply to let you know your message has been received. Your message is being forwarded to the package maintainers and other interested parties for their attention; they will reply in due course. Your message has been sent to the package maintainer(s): bug-gnu-emacs@HIDDEN If you wish to submit further information on this problem, please send it to 76789 <at> debbugs.gnu.org. Please do not send mail to help-debbugs@HIDDEN unless you wish to report a problem with the Bug-tracking system. --=20 76789: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D76789 GNU Bug Tracking System Contact help-debbugs@HIDDEN with problems
X-Loop: help-debbugs@HIDDEN Subject: bug#76789: 31.0.50; [PATCH] speedbar: New speedbar-window-mode Resent-From: Eli Zaretskii <eliz@HIDDEN> Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> Resent-CC: bug-gnu-emacs@HIDDEN Resent-Date: Fri, 07 Mar 2025 06:51:02 +0000 Resent-Message-ID: <handler.76789.B76789.17413302429360 <at> debbugs.gnu.org> Resent-Sender: help-debbugs@HIDDEN X-GNU-PR-Message: followup 76789 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Vincenzo Pupillo <v.pupillo@HIDDEN> Cc: 76789 <at> debbugs.gnu.org Received: via spool by 76789-submit <at> debbugs.gnu.org id=B76789.17413302429360 (code B ref 76789); Fri, 07 Mar 2025 06:51:02 +0000 Received: (at 76789) by debbugs.gnu.org; 7 Mar 2025 06:50:42 +0000 Received: from localhost ([127.0.0.1]:46602 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1tqRXe-0002Qt-88 for submit <at> debbugs.gnu.org; Fri, 07 Mar 2025 01:50:42 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:58554) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1tqRXb-0002Qf-Lz for 76789 <at> debbugs.gnu.org; Fri, 07 Mar 2025 01:50:40 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <eliz@HIDDEN>) id 1tqRXV-0004ey-DE; Fri, 07 Mar 2025 01:50:33 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=dBFlQMFlhlTFUlsuQGK4ZRaLNXCrJ/a8shZixHEHw2Y=; b=XXJgttKqHotJ rgAw9P4TcI4UE64D1zRYLR4ThtNSGPj410nnfA2qfrgtrh6l6tw+/ytZui2haU/0jVhMrs3c9GNHq M12P1uaEEWgrHt3XTKMQ0v89oJn6W0io4lnXmGjF/ZXiLewdH3ij5lR1I6GdedsQcEFtWJQ6cIcNM rTm+f7LyKUbVvd3x+8aR/pWhiW85RIV5vI1RqhqqRKLZoboXNT2fpxUqcn8gOroOBj/vtuUYKdidR zmkN3Vr2LUlyLLZaBkbqsqRT+N5CtLm8XJWra/tS5GWTfClDyclcV6rrYAViY6ALIJ+1CvtDVz9+d iASZyvnGEDGSUZZRthXHHA==; Date: Fri, 07 Mar 2025 08:50:23 +0200 Message-Id: <86wmd1l4gg.fsf@HIDDEN> From: Eli Zaretskii <eliz@HIDDEN> In-Reply-To: <5658405.rdbgypaU67@fedora> (message from Vincenzo Pupillo on Thu, 06 Mar 2025 21:42:12 +0100) References: <5658405.rdbgypaU67@fedora> X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -3.3 (---) > From: Vincenzo Pupillo <v.pupillo@HIDDEN> > Date: Thu, 06 Mar 2025 21:42:12 +0100 > > Ciao, > this patch adds speedbar-window-mode as an alternative to the default > speedbar-frame-mode. Calling speedbar-window-mode will close speedbar-frame- > mode if it is open, and vice versa. > speedbar-window-mode, thanks to display-buffer-in-side-window, can be placed > on the left side, right side but also on the top or bottom. Thanks, a few comments below. > +(defcustom speedbar-window-default-width 20 > + "Initial width of `speedbar-window' under window system. > +The default value is the same width of `speedbar-frame-mode'." > + :type 'integer > + :group 'speedbar > + :version "31.1") > + > +(defcustom speedbar-window-max-width 40 > + "The maximum allowed `speedbar-window' width limit." > + :type 'integer > + :group 'speedbar > + :version "31.1") These two options should document in their doc strings the units in which the dimensions are measured. > +(defun speedbar (&optional arg) > + "Open or close the `speedbar'. Positive ARG means turn on, negative turn off. The first line of a doc string should be a single complete sentence. > +A nil ARG means toggle. When `speedbar-prefer-window' open the > +speedbar in a window istead of in a frame." This should say what happens if speedbar-prefer-window is nil. Also, please don't use "when" to indicate a condition (as opposed to something related to time), as it could be misinterpreted. > +(defalias 'speedbar-frame 'speedbar-frame-mode) This alias should be in NEWS. Speedbar has its own manual. Did you consider updating that manual with this new feature?
X-Loop: help-debbugs@HIDDEN Subject: bug#76789: 31.0.50; [PATCH] speedbar: New speedbar-window-mode References: <5658405.rdbgypaU67@fedora> In-Reply-To: <5658405.rdbgypaU67@fedora> Resent-From: Angelo Graziosi <angelo.g0@HIDDEN> Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> Resent-CC: bug-gnu-emacs@HIDDEN Resent-Date: Sat, 08 Mar 2025 16:13:02 +0000 Resent-Message-ID: <handler.76789.B76789.17414503664074 <at> debbugs.gnu.org> Resent-Sender: help-debbugs@HIDDEN X-GNU-PR-Message: followup 76789 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: 76789 <at> debbugs.gnu.org Received: via spool by 76789-submit <at> debbugs.gnu.org id=B76789.17414503664074 (code B ref 76789); Sat, 08 Mar 2025 16:13:02 +0000 Received: (at 76789) by debbugs.gnu.org; 8 Mar 2025 16:12:46 +0000 Received: from localhost ([127.0.0.1]:56291 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1tqwn8-00013d-8M for submit <at> debbugs.gnu.org; Sat, 08 Mar 2025 11:12:46 -0500 Received: from smtp-18.italiaonline.it ([213.209.10.18]:55768 helo=libero.it) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from <angelo.g0@HIDDEN>) id 1tqwn2-00013H-6E for 76789 <at> debbugs.gnu.org; Sat, 08 Mar 2025 11:12:41 -0500 Received: from [192.168.43.62] ([109.55.238.220]) by smtp-18.iol.local with ESMTPA id qwmuthbLxG7JNqwmvt7r9H; Sat, 08 Mar 2025 17:12:33 +0100 x-libjamoibt: 1601 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=libero.it; s=s2021; t=1741450353; bh=EjYLakFdY2fwXH/yrQVZDofGJF9asum7iRu7vc2FYJ8=; h=From; b=hZ0TLemr0+fTv08SbEHpUAlZG4J3oyjk+yZM6fzju8EnXy8lFROOZbu6RyqQMPioD nVkBx5YH1GF8YqJUrh6NtO3pIx5/qGeFvLwh/lMEBZm+emBUDsPPV4LQGxw5w965tz W/6pOa4toe3v+43JoCz0JJIF/mIb1w9dNRtink2TeMg4U+hGj+wpNRSPZ5zkt7+iAn Rj6TwBbC/3UCj/P8QVD5zQuFNDXf7hzRvWS+CcPeVOKscGH9Db6qYPUrhUOh1eo53g lxTfy366+WgjtnIJEaLnBY8HBvlzcAGxGfrdsMWPRzA9uSyp42M5YIwV1At5YRP/Aq h1X2kAtU2c/xQ== X-CNFS-Analysis: v=2.4 cv=U6BZDvru c=1 sm=1 tr=0 ts=67cc6c71 cx=a_exe a=YGOZSecrEDyz7zk05Vtzqg==:117 a=YGOZSecrEDyz7zk05Vtzqg==:17 a=IkcTkHD0fZMA:10 a=xPJf0xN0An0ikSANh70A:9 a=QEXdDO2ut3YA:10 Message-ID: <1c91f952-4cd8-417c-bdfc-20e080057ece@HIDDEN> Date: Sat, 8 Mar 2025 17:12:32 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Content-Language: it, en-GB, en-US From: Angelo Graziosi <angelo.g0@HIDDEN> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-CMAE-Envelope: MS4xfCgTGvmRcyjGZIjDCOLfUsJLmkoAoAJolqfDPVA7wbFKYuZudXwDZI+o789FCjNcJM4BDzmlfxBX+Dl4fA80Z0twGe0bAEuV9ZjjtWOzCyPFs7f3dwXk fCpub98YfZdVATex8bHViUMeutQL8/H8LEbnYzEGGXpACWf7iGBxng06v1b1sLDbmlCWvd1zLcHed0Z3Oo5WKxLxpiXLnSsNx2U= X-Spam-Score: 0.3 (/) X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -0.7 (/) Ciao Vincenzo, me too used sr-speedbar for years. Now I have built Emacs with your patch and it looks good. Thanks. Ciao, Angelo.
X-Loop: help-debbugs@HIDDEN Subject: bug#76789: 31.0.50; [PATCH] speedbar: New speedbar-window-mode Resent-From: Vincenzo Pupillo <v.pupillo@HIDDEN> Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> Resent-CC: bug-gnu-emacs@HIDDEN Resent-Date: Sat, 08 Mar 2025 22:07:01 +0000 Resent-Message-ID: <handler.76789.B76789.174147158819495 <at> debbugs.gnu.org> Resent-Sender: help-debbugs@HIDDEN X-GNU-PR-Message: followup 76789 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Eli Zaretskii <eliz@HIDDEN> Cc: 76789 <at> debbugs.gnu.org Received: via spool by 76789-submit <at> debbugs.gnu.org id=B76789.174147158819495 (code B ref 76789); Sat, 08 Mar 2025 22:07:01 +0000 Received: (at 76789) by debbugs.gnu.org; 8 Mar 2025 22:06:28 +0000 Received: from localhost ([127.0.0.1]:57098 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1tr2JO-00054L-MN for submit <at> debbugs.gnu.org; Sat, 08 Mar 2025 17:06:27 -0500 Received: from mail-wm1-x32a.google.com ([2a00:1450:4864:20::32a]:52539) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from <v.pupillo@HIDDEN>) id 1tr2JK-00053w-Ai for 76789 <at> debbugs.gnu.org; Sat, 08 Mar 2025 17:06:24 -0500 Received: by mail-wm1-x32a.google.com with SMTP id 5b1f17b1804b1-4394a0c65fcso32531515e9.1 for <76789 <at> debbugs.gnu.org>; Sat, 08 Mar 2025 14:06:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1741471576; x=1742076376; darn=debbugs.gnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ad/KMOGgj02QXCntRV3Ig38tZPqFmEYnyX3BN6CA9Aw=; b=A0YrYfyQAsTTknOnqU+KfDqhx6eDVQZlJlcHmhlXBrqUh1jaNR31Ctn6l7LLZPbp7C XJus03OmxPnAFVJy8dbwybsZZsc2T3Zjul35Q/1LZd6HzAGUM/Gs08rmC/4c4Tx8hZvp ZdPYPU7n1T7SxaHsdipvsmPMCjKdvoDpfyocEYfgdRIR6EoPCrpd3NuIzyX/Yk/eUsdd 4oavSC+dgKO6r5KTsfnjbK9HRnd/mlrv0VNx5x/Q/Sw2WzOZJELashJfOX1OkBxCxP+J 942sTiqTDMw8LFt22I0QBVwr+D1/KfZixkxyaA88bUJbOf1cyOmbwhGnQ/qDiXVsuwwi e6xQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1741471576; x=1742076376; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ad/KMOGgj02QXCntRV3Ig38tZPqFmEYnyX3BN6CA9Aw=; b=HBCIX6Wem9rAwkRI8YkCaLP/vvqyb1a94R7AfcDBcmeYaCN4CR4tAAoEGj07h1TM3q TQxusVohhuPts/9UrTCwRPZ8OVPAoWpKmiNj7u/8lkTI9clIQXerkjKM1JFhA0OiM8y8 3mMkWdzHHXI7Y0b+zzZNKWi6uVEzx9JaYal7kJDpzyKIf6LeobFbjYNQp/jRmZRazJNI F+Me+un9BrOxhQqyurZBhZ6DIp0kbe7eSwEM99E9Vj8zXdmcY7/NC+YKLNy/yt2SVXsK dZBZDQuRTgVMXYmPZwU0mHcWY0VVpJKhN5P+mlySiLZzQrIRw3USQLbfLqE4tOuuOPaA 3jgg== X-Gm-Message-State: AOJu0YyDfCKh7HoxhOHUwfmF4QcXCVtgjyt/gvzEeFGFy+IWadPe0+/o FgXLa1uwigeoz5awTVvQ8FeQlul4Gjf5QtC0WwrcMDz13Ju1PpH5 X-Gm-Gg: ASbGnct1d39bGoemfNcneRHckE66h3GvjBw2POixS5S79uyN1VmUhXY45JrJ1WPS1a3 r1Z9axkc6+a1b8X9HLswodBwhEs3BMILo8V0cJmveG6beCYMaDFFeb6xR3YrJ8d6xX8EnKGU0oJ 68bBw9W+nekjaxHEi/h98M9sICFfRYA7qJK9we3AjSg6NBjiwRwtWRd4lFXKMkMye+LsDdFN/YW pT7QdEELebrgwDUiAnuFLPn/JZ8Vx7pIJPOVZtQD3ISjRrwviSriHmXxwSVJ2EL+GuM0Z/C3no3 LYJ2ZpL9FtR1AuobE95qEacmnRLqYH/acZTw3KUjHzAQWdDV0GGQ3qkGD7gDZAQuN8XUYjkhdzr tMKqjQXIG X-Google-Smtp-Source: AGHT+IH2LLFhMSI2y3nDUrIa1raYM79AH17ORxWG28KlOrxbHb/ELa9zGsTGfOdbLWZ55LUJPt9daA== X-Received: by 2002:a05:600c:314d:b0:43b:bfb7:e099 with SMTP id 5b1f17b1804b1-43c602222ecmr64893175e9.29.1741471575537; Sat, 08 Mar 2025 14:06:15 -0800 (PST) Received: from fedora.localnet (2-230-139-124.ip202.fastwebnet.it. [2.230.139.124]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-43ceef2fb8dsm13628105e9.18.2025.03.08.14.06.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 08 Mar 2025 14:06:14 -0800 (PST) From: Vincenzo Pupillo <v.pupillo@HIDDEN> Date: Sat, 08 Mar 2025 23:06:13 +0100 Message-ID: <5050698.OV4Wx5bFTl@fedora> In-Reply-To: <86wmd1l4gg.fsf@HIDDEN> References: <5658405.rdbgypaU67@fedora> <86wmd1l4gg.fsf@HIDDEN> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="nextPart26909221.1r3eYUQgxm" Content-Transfer-Encoding: 7Bit X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -1.0 (-) This is a multi-part message in MIME format. --nextPart26909221.1r3eYUQgxm Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Ciao Eli, In data venerd=C3=AC 7 marzo 2025 07:50:23 Ora standard dell=E2=80=99Europa= centrale, Eli=20 Zaretskii ha scritto: > > From: Vincenzo Pupillo <v.pupillo@HIDDEN> > > Date: Thu, 06 Mar 2025 21:42:12 +0100 > >=20 > > Ciao, > > this patch adds speedbar-window-mode as an alternative to the default > > speedbar-frame-mode. Calling speedbar-window-mode will close > > speedbar-frame- mode if it is open, and vice versa. > > speedbar-window-mode, thanks to display-buffer-in-side-window, can be > > placed on the left side, right side but also on the top or bottom. >=20 > Thanks, a few comments below. >=20 > > +(defcustom speedbar-window-default-width 20 > > + "Initial width of `speedbar-window' under window system. > > +The default value is the same width of `speedbar-frame-mode'." > > + :type 'integer > > + :group 'speedbar > > + :version "31.1") > > + > > +(defcustom speedbar-window-max-width 40 > > + "The maximum allowed `speedbar-window' width limit." > > + :type 'integer > > + :group 'speedbar > > + :version "31.1") >=20 > These two options should document in their doc strings the units in > which the dimensions are measured. Done. >=20 > > +(defun speedbar (&optional arg) > > + "Open or close the `speedbar'. Positive ARG means turn on, negative > > turn off. > The first line of a doc string should be a single complete sentence. >=20 Done. > > +A nil ARG means toggle. When `speedbar-prefer-window' open the > > +speedbar in a window istead of in a frame." >=20 > This should say what happens if speedbar-prefer-window is nil. Also, > please don't use "when" to indicate a condition (as opposed to > something related to time), as it could be misinterpreted. >=20 Done. > > +(defalias 'speedbar-frame 'speedbar-frame-mode) >=20 > This alias should be in NEWS. >=20 Done. In addition, I fixed the speedbar menu so that it also works properly with= =20 speedbar-window. > Speedbar has its own manual. Did you consider updating that manual > with this new feature? I wrote something in speedbar.texi (not included in this patch), but I also= =20 saw that the emacs manual has section 18.9 Speedbar Frame (chapter 18 Frame= s=20 and Graphical Display), and I am not sure how to edit it. Thank. Vincenzo --nextPart26909221.1r3eYUQgxm Content-Disposition: attachment; filename="0001-Add-a-new-command-speedbar-window.patch" Content-Transfer-Encoding: 7Bit Content-Type: text/x-patch; charset="UTF-8"; name="0001-Add-a-new-command-speedbar-window.patch" From 2ff7de450bd3f37d739cb40c4dfdaa3bd4828290 Mon Sep 17 00:00:00 2001 From: Vincenzo Pupillo <vincenzo.pupillo@HIDDEN> Date: Thu, 6 Mar 2025 13:39:01 +0100 Subject: [PATCH] Add a new command `speedbar-window'. Speedbar now can be opened in a window instead of a frame. The frame remains the default. * lisp/speedbar.el (speedbar-prefer-window): New user option. If t, the command `speedbar' open the speedbar in a window. (speedbar-window-dedicated-window): New user option. If t the window is dedicated. (speedbar-window-side): New user option. The side of 'speedbar-window', defaults to left. (speedbar-window-default-width): New user option. The default size of the 'speedbar-window'. (speedbar-window-max-width): New user option. Limits the width of the 'speedbar-window'. The user can resize the window as desired, but this option will be the width of the window when restored. (speedbar--buffer-name): New variable, the buffer name used for both 'speedbar-frame-mode' and 'speedbar-window-mode'. (speedbar--window): New variable, the window displaying 'speedbar-window'. (speedbar--window-width): New variable, store the current width of 'speedbar-window'. (speedbar-easymenu-definition-trailer): Now it is a function that returns a different trailer for 'speedbar-frame' and 'speedbar-window'. (speedbar): Now it is a function that calls 'speedbar-frame-mode', the default or 'speedbar-window-mode' based on the value of 'speedbar-prefer-window'. (speedbar-frame-mode): Before opening a frame, close 'speedbar-window' if it is open. (speedbar-is-frame-or-window-p): New function, returns 'frame', 'window' or nil if speedbar is not open. (speedbar-window): New alias for 'speedbar-window-mode'. (speedbar-window-mode): Enable of disable 'speedbar-window'. (speedbar-window--window-live-p): New function, return non-nil if the 'speedbar-window' is live. (speedbar-window--buffer-live-p): New function, return non-nil if the 'speedbar-buffer' is live. (speedbar-window--live-p): New function, return t if 'speedbar-window' is open. (speedbar-window-current-window): New function, return t if the selected window is speedbar-window. (speedbar-window--close): New function, close the 'speedbar-window'. (speedbar-window--width): New function, return the current width of 'speedbar-window'. (speedbar-width): New function, return the 'speedbar' of 'speedbar-frame-mode' of 'speedbar-frame-mode'. (speedbar-set-mode-line-format): Use the new 'speedbar-width' function. (speedbar-directory-buttons): Use the new 'speedbar-width' function. (speedbar--speedbar-live-p): New function, returns t if 'speedbar-frame-mode' or 'speedbar-window-mode' are open. (speedbar-timer-fn): Now handle 'speedbar-frame-mode' and 'speedbar-window-mode'. --- etc/NEWS | 13 +++ lisp/speedbar.el | 298 ++++++++++++++++++++++++++++++++++++++--------- 2 files changed, 259 insertions(+), 52 deletions(-) diff --git a/etc/NEWS b/etc/NEWS index ef4cacb20f9..497cd8e358c 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -1375,6 +1375,19 @@ Major-mode authors can customize the variables 'yank-media-autoselect-function' and/or 'yank-media-preferred-types' to change the selection rules. +** Speedbar + +--- +*** The new command 'speedbar-window-mode' open Speedbar in a window instead +of a frame. + +*** New alias 'speedbar-window' is an alias for 'speedbar-window-mode'. +' +*** The new user option 'speedbar-prefer-window', tell 'speedbar' to open +a side window instead of a frame. + +*** 'speedbar-easymenu-definition-trailer' is now a function. + ** Miscellaneous --- diff --git a/lisp/speedbar.el b/lisp/speedbar.el index 104e23b9bc9..085865cef44 100644 --- a/lisp/speedbar.el +++ b/lisp/speedbar.el @@ -22,9 +22,9 @@ ;;; Commentary: ;; -;; The speedbar provides a frame in which files, and locations in -;; files are displayed. These items can be clicked on with mouse-2 in -;; to display that file location. +;; The speedbar provides a frame or a window in which files, and +;; locations in files are displayed. These items can be clicked on with +;; mouse-2 in to display that file location. ;; ;;; Customizing and Developing for speedbar ;; @@ -139,8 +139,53 @@ speedbar-use-images :version "21.1" :type 'boolean) +(defcustom speedbar-prefer-window nil + "If t, the command `speedbar' open the speedbar in a window." + :type 'boolean + :group 'speedbar + :version "31.1") + +(defcustom speedbar-window-dedicated-window t + "Make the `speedbar-window' dedicated." + :group 'speedbar + :type 'boolean + :version "31.1") + +(defcustom speedbar-window-side 'left + "Show the `speedbar-window' on the `left', `right', `top' or `bottom'. +See `display-buffer-in-side-window' for more details." + :type '(radio (const :tag "Left" left) + (const :tag "Right" right) + (const :tag "Top" top) + (const :tag "Bottom" bottom)) + :group 'speedbar + :version "31.1") + +(defcustom speedbar-window-default-width 20 + "Initial width in characters of `speedbar-window' under window system. +The default value is the same width of `speedbar-frame-mode'." + :type 'integer + :group 'speedbar + :version "31.1") + +(defcustom speedbar-window-max-width 40 + "The maximum allowed width in characters of the `speedbar-window'." + :type 'integer + :group 'speedbar + :version "31.1") + ;;; Code: +(defconst speedbar--buffer-name " SPEEDBAR" + "Speedbar buffer name.") + +(defvar speedbar--window nil + "The window displaying `speedbar-window'.") + +(defvar speedbar--window-width speedbar-window-default-width +"Stores the current width of `speedbar-window'. +Subsequent calls to `speedbar-window' will open a window of this width.") + (defvar speedbar-initial-expansion-mode-alist '(("buffers" speedbar-buffer-easymenu-definition speedbar-buffers-key-map speedbar-buffer-buttons) @@ -844,11 +889,18 @@ speedbar-easymenu-definition-special ) "Additional menu items while in file-mode.") -(defvar speedbar-easymenu-definition-trailer - '(["Customize..." speedbar-customize t] - ["Close" dframe-close-frame t] - ["Quit" delete-frame t]) - "Menu items appearing at the end of the speedbar menu.") +(defun speedbar-easymenu-definition-trailer () + "Menu items appearing at the end of the speedbar menu." + (let ((type (speedbar-is-frame-or-window-p))) + (cond ((eq type 'frame) + '(["Customize..." speedbar-customize t] + ["Close" dframe-close-frame t] + ["Quit" delete-frame t])) + ((eq type 'window) + '(["Customize..." speedbar-customize t] + ["Close" + (lambda () (interactive) (speedbar-window--close)) + :keys "q" :active t]))))) (defvar speedbar-desired-buffer nil "Non-nil when speedbar is showing buttons specific to a special mode. @@ -891,7 +943,19 @@ 'speedbar-mode-line-update ;; ;;;###autoload -(defalias 'speedbar 'speedbar-frame-mode) +(defun speedbar (&optional arg) + "Open or close the `speedbar'. +Positive ARG means turn on, negative turn off. +A nil ARG means toggle. If `speedbar-prefer-window' is t, open the +speedbar in a window istead of in a frame." + (interactive "P") + (if speedbar-prefer-window + (speedbar-window-mode arg) + (speedbar-frame-mode arg))) + +;;;###autoload +(defalias 'speedbar-frame 'speedbar-frame-mode) + ;;;###autoload (defun speedbar-frame-mode (&optional arg) "Enable or disable speedbar. Positive ARG means turn on, negative turn off. @@ -901,10 +965,12 @@ speedbar-frame-mode `speedbar-before-popup-hook' is called before popping up the speedbar frame. `speedbar-before-delete-hook' is called before the frame is deleted." (interactive "P") + (when (eq (speedbar-is-frame-or-window-p) 'window) + (speedbar-window--close)) ;; Get the buffer to play with (if (not (buffer-live-p speedbar-buffer)) (with-current-buffer - (setq speedbar-buffer (get-buffer-create " SPEEDBAR")) + (setq speedbar-buffer (get-buffer-create speedbar--buffer-name)) (speedbar-mode))) ;; Do the frame thing (dframe-frame-mode arg @@ -934,6 +1000,115 @@ speedbar-frame-mode (message (substitute-command-keys "Use \\[speedbar-get-focus] to see the speedbar window")))) +(defun speedbar-is-frame-or-window-p () + "Return 'frame' of 'window' if one of each are open. +Return nil if both are closed." + (cond + ((speedbar-window--live-p) + 'window) + ((and (frame-live-p (speedbar-current-frame)) + speedbar-buffer + (not (speedbar-window--live-p))) + 'frame) + (t nil))) + +;;;###autoload +(defalias 'speedbar-window 'speedbar-window-mode) +;;;###autoload +(defun speedbar-window-mode (&optional arg) + "Enable or disable speedbar window. +Positive ARG means turn on, negative turn off. +A nil ARG means toggle. Once the speedbar window is activated, a buffer in +`speedbar-mode' will be displayed. Currently, only one speedbar is +supported at a time. +`speedbar-before-popup-hook' is called before popping up the speedbar frame. +`speedbar-before-delete-hook' is called before the frame is deleted." + (interactive "P") + (when (eq (speedbar-is-frame-or-window-p) 'frame) + (delete-frame (speedbar-current-frame))) + + (if (or (and (not arg) (speedbar-window--live-p)) + (and (numberp arg) (< arg 0))) + (speedbar-window--close) + (let ((current-window (selected-window))) + (unless (speedbar-window--buffer-live-p) + (setq speedbar-buffer (get-buffer-create speedbar--buffer-name))) + + (setq speedbar-frame (selected-frame) + dframe-attached-frame (selected-frame) + speedbar-select-frame-method 'attached + speedbar-last-selected-file nil) + + (set-buffer speedbar-buffer) + (speedbar-mode) + + ;; let's create the window + (setq speedbar--window + (display-buffer-in-side-window speedbar-buffer + `((side ,@speedbar-window-side) + (slot . 0) + (dedicated ,@speedbar-window-dedicated-window) + (window-width ,@speedbar--window-width)))) + ;; additional window parameters + (set-window-parameter speedbar--window 'no-other-window t) + (set-window-parameter speedbar--window 'no-delete-other-windows t) + + ;; `speedbar-reconfigure-keymaps' checks if the `speedbar-window' is open, so + ;; should stay after the buffer and window definition. + (speedbar-reconfigure-keymaps) + (speedbar-update-contents) + (speedbar-set-timer dframe-update-speed) + + ;; hscroll + (setq-local auto-hscroll-mode nil) + ;; reset the selection variable + (setq speedbar-last-selected-file nil) + (select-window current-window)))) + +(defsubst speedbar-window--window-live-p () + "Return non-nil if `speedbar--window' is defined and live." + (when (and speedbar--window (window-live-p speedbar--window)) + speedbar--window)) + +(defsubst speedbar-window--buffer-live-p () + "Return non-nil `speedbar-buffer' is defined and live." + (when (and speedbar-buffer (buffer-live-p speedbar-buffer)) + speedbar-buffer)) + +(defun speedbar-window--live-p () + "Return t if `speedbar-window' is opened." + (and (speedbar-window--buffer-live-p) (speedbar-window--window-live-p))) + +(defsubst speedbar-window-current-window () + "Return t if the current windows is the `speedbar--window'." + (eq (selected-window) speedbar--window)) + +(defun speedbar-window--close () + "Close `speedbar-window'." + (when (speedbar-window--live-p) + (let ((current-window (selected-window))) + ;; store the current window width + (setq speedbar--window-width + (let ((current-width (speedbar-window--width))) + (if (> current-width speedbar-window-max-width) + speedbar-window-max-width + current-width))) + + (delete-window speedbar--window) + (setq speedbar--window nil + speedbar-frame nil + dframe-attached-frame nil) + (speedbar-set-timer nil) + (kill-buffer speedbar-buffer) + (setq speedbar-buffer nil) + (when (and current-window (window-live-p current-window)) + (select-window current-window))))) + +(defsubst speedbar-window--width () + "Return the width of `speedbar-window' WINDOW." + (let ((edges (window-edges speedbar--window))) + (- (nth 2 edges) (nth 0 edges)))) + (defun speedbar-frame-reposition-smartly () "Reposition the speedbar frame to be next to the attached frame." (cond ((or (assoc 'left speedbar-frame-parameters) @@ -980,6 +1155,14 @@ speedbar-frame-width Return nil if it doesn't exist." (frame-width speedbar-frame)) +(defun speedbar-width () + "Returns the width of the `speedbar'. +if `speedbar-window-mode' is open, the width is `speedbar-window--width' +otherwise the width is `speedbar-frame-width'." + (if (speedbar-window--live-p) + (speedbar-window--width) + (speedbar-frame-width))) + (define-derived-mode speedbar-mode fundamental-mode "Speedbar" "Major mode for managing a display of directories and tags. \\<speedbar-mode-map> @@ -1066,7 +1249,7 @@ speedbar-set-mode-line-format (if (and (frame-live-p (speedbar-current-frame)) speedbar-buffer) (with-current-buffer speedbar-buffer - (let* ((w (or (speedbar-frame-width) 20)) + (let* ((w (or (speedbar-width) 20)) (p1 "<<") (p5 ">>") (p3 (if speedbar-update-flag "#" "!")) @@ -1128,7 +1311,7 @@ speedbar-reconfigure-keymaps (setq alist (cdr alist))) displays))) ;; The trailer - speedbar-easymenu-definition-trailer)) + (speedbar-easymenu-definition-trailer))) (localmap (save-excursion (let ((cf (selected-frame))) (prog2 @@ -1838,7 +2021,7 @@ speedbar-directory-buttons ;; Nuke the beginning of the directory if it's too long... (cond ((eq speedbar-directory-button-trim-method 'span) (beginning-of-line) - (let ((ww (or (speedbar-frame-width) 20))) + (let ((ww (or (speedbar-width) 20))) (move-to-column ww nil) (while (>= (current-column) ww) (re-search-backward "[/\\]" nil t) @@ -1854,7 +2037,7 @@ speedbar-directory-buttons (move-to-column ww nil))))) ((eq speedbar-directory-button-trim-method 'trim) (end-of-line) - (let ((ww (or (speedbar-frame-width) 20)) + (let ((ww (or (speedbar-width) 20)) (tl (current-column))) (if (< ww tl) (progn @@ -2525,56 +2708,67 @@ speedbar-set-timer ;; change this if it changed for some reason (speedbar-set-mode-line-format)) +(defun speedbar--speedbar-live-p () + "Return non-nil if `speedbar-window-mode' or `speedbar-frame-mode' are open." + (cond + ((and (speedbar-current-frame) + (frame-live-p (speedbar-current-frame))) + t) + ((speedbar-window--window-live-p) t) + (t nil))) + (defun speedbar-timer-fn () "Run whenever Emacs is idle to update the speedbar item." - (if (or (not (speedbar-current-frame)) - (not (frame-live-p (speedbar-current-frame)))) + (if (not (speedbar--speedbar-live-p)) (speedbar-set-timer nil) ;; Save all the match data so that we don't mess up executing fns (save-match-data ;; Only do stuff if the frame is visible, not an icon, and if ;; it is currently flagged to do something. (if (and speedbar-update-flag - (speedbar-current-frame) + (or (speedbar-window-current-window) + (speedbar-current-frame)) (frame-visible-p (speedbar-current-frame)) (not (eq (frame-visible-p (speedbar-current-frame)) 'icon))) (let ((af (selected-frame))) - (dframe-select-attached-frame speedbar-frame) - ;; make sure we at least choose a window to - ;; get a good directory from - (if (window-minibuffer-p) - nil - ;; Check for special modes - (speedbar-maybe-add-localized-support (current-buffer)) - ;; Update for special mode all the time! - (if (and speedbar-mode-specific-contents-flag - (consp speedbar-special-mode-expansion-list) - (local-variable-p - 'speedbar-special-mode-expansion-list - (current-buffer))) - ;;(eq (get major-mode 'mode-class 'special))) - (progn - (if (<= 2 speedbar-verbosity-level) + (dframe-select-attached-frame speedbar-frame) + ;; make sure we at least choose a window to + ;; get a good directory from + (if (window-minibuffer-p) + nil + ;; Check for special modes + (speedbar-maybe-add-localized-support (current-buffer)) + ;; Update for special mode all the time! + (if (and speedbar-mode-specific-contents-flag + (consp speedbar-special-mode-expansion-list) + (local-variable-p + 'speedbar-special-mode-expansion-list + (current-buffer))) + ;;(eq (get major-mode 'mode-class 'special))) + (progn + (if (<= 2 speedbar-verbosity-level) + (dframe-message + "Updating speedbar to special mode: %s..." + major-mode)) + (speedbar-update-special-contents) + (if (<= 2 speedbar-verbosity-level) + (progn (dframe-message - "Updating speedbar to special mode: %s..." - major-mode)) - (speedbar-update-special-contents) - (if (<= 2 speedbar-verbosity-level) - (progn - (dframe-message - "Updating speedbar to special mode: %s...done" - major-mode) - (dframe-message nil)))) - - ;; Update all the contents if directories change! - (unless (and (or (member major-mode speedbar-ignored-modes) - (eq af (speedbar-current-frame)) - (not (buffer-file-name))) - ;; Always update for GUD. - (not (string-equal "GUD" - speedbar-initial-expansion-list-name))) - (speedbar-update-localized-contents))) - (select-frame af)) + "Updating speedbar to special mode: %s...done" + major-mode) + (dframe-message nil)))) + + ;; Update all the contents if directories change! + (unless (and (or (member major-mode speedbar-ignored-modes) + (and + (eq af (speedbar-current-frame)) + (speedbar-window-current-window)) + (not (buffer-file-name))) + ;; Always update for GUD. + (not (string-equal "GUD" + speedbar-initial-expansion-list-name))) + (speedbar-update-localized-contents))) + (select-frame af)) ;; Now run stealthy updates of time-consuming items (speedbar-stealthy-updates))))) (run-hooks 'speedbar-timer-hook)) -- 2.48.1 --nextPart26909221.1r3eYUQgxm--
X-Loop: help-debbugs@HIDDEN Subject: bug#76789: 31.0.50; [PATCH] speedbar: New speedbar-window-mode Resent-From: Vincenzo Pupillo <v.pupillo@HIDDEN> Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> Resent-CC: bug-gnu-emacs@HIDDEN Resent-Date: Sat, 08 Mar 2025 22:35:01 +0000 Resent-Message-ID: <handler.76789.B.174147328324221 <at> debbugs.gnu.org> Resent-Sender: help-debbugs@HIDDEN X-GNU-PR-Message: followup 76789 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: 76789 <at> debbugs.gnu.org Cc: Angelo Graziosi <angelo.g0@HIDDEN> X-Debbugs-Original-To: 76789 <at> debbugs.gnu.org, bug-gnu-emacs@HIDDEN Received: via spool by submit <at> debbugs.gnu.org id=B.174147328324221 (code B ref -1); Sat, 08 Mar 2025 22:35:01 +0000 Received: (at submit) by debbugs.gnu.org; 8 Mar 2025 22:34:43 +0000 Received: from localhost ([127.0.0.1]:57126 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1tr2kl-0006Ia-2T for submit <at> debbugs.gnu.org; Sat, 08 Mar 2025 17:34:43 -0500 Received: from lists.gnu.org ([2001:470:142::17]:43964) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from <v.pupillo@HIDDEN>) id 1tr2kc-0006I3-Hf for submit <at> debbugs.gnu.org; Sat, 08 Mar 2025 17:34:35 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <v.pupillo@HIDDEN>) id 1tr2kW-0000a7-He for bug-gnu-emacs@HIDDEN; Sat, 08 Mar 2025 17:34:28 -0500 Received: from mail-wr1-x42c.google.com ([2a00:1450:4864:20::42c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from <v.pupillo@HIDDEN>) id 1tr2kV-0007eH-0L for bug-gnu-emacs@HIDDEN; Sat, 08 Mar 2025 17:34:28 -0500 Received: by mail-wr1-x42c.google.com with SMTP id ffacd0b85a97d-3913958ebf2so1048515f8f.3 for <bug-gnu-emacs@HIDDEN>; Sat, 08 Mar 2025 14:34:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1741473265; x=1742078065; darn=gnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=KQVzPwWfyXKRS0IN0fVwEke8dpwh5h3oQL45nhWNT2c=; b=PZOeTagF3pcdl8mw8ZaA/3fwXpjyAGOFjgx4BrdWO76iGyzqCnvLzjCU4Q65Lw6nX1 fPtJ3WUIOgTNFKyXxzNSI75eoaLOmkfYRtVPNdEYRH5MKSJi4t/kmXXSlpfqlz1s/C// KUJ+3fSLQ5blRlQjIU1DGnbFv5BSDYqIJswchAGAqb+cZWdRean65qXYfAU/qCCcdXA2 v+fdQYTP1tlfkXdlqfX8cITn7bbXbVW6uzcimFwVfkvaqGIt6FFGVU7vZxPvcMl5251V SNjG61UJoDaKvGXLUshMflWBj39Ya4uTR4u+nH5oOtjvK1TNd1T1RVsFLyis4GzJPsVl 8YkQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1741473265; x=1742078065; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=KQVzPwWfyXKRS0IN0fVwEke8dpwh5h3oQL45nhWNT2c=; b=r5SDazV58nH49SrWN78Xn55lwrCmd/K+ax65wjPwo04kS8gbI/ebW76IXTN9baurfm hfMa6RS9ZPHVH7yNPr/AuL/9Vx8uOUoCd44mK/Ob/AKMCSKkJSopGjKDDMCvn2daiBwj JabFQK5r9aCkLUqYRiUDKpD29cX5uM7Y401DLe7A4s8QrUDVc4l/Tbc2Rsqtey3sMtWv ujvfTWKn0cx/uOiRDSvc7FnuqcVmbG7uQhqvzOx7Qzx3AbnPYYLlhWjm90wLyG7oFcVG 8W2pKysagauNBRUaU/zr2HIy9/awHwMKGU7iO8HFanaH7Q7Tiz2eNwgpZ7T08ojOjuSg LuMw== X-Forwarded-Encrypted: i=1; AJvYcCXLoIK2oY0hsc2W5cmVdGEtuiupBE6V82hxtuITr1YYR1UTssTnY2Of/KB+Vzv4j1dmLHoOFHrZlMHBFZa6@HIDDEN X-Gm-Message-State: AOJu0YyGAKmh09xqt/mS70EFlgAYM5qXW2v0qWuFEltkjrPGFJpvo4Pd e5ynxwVd75OB7KXsMNO7ZhDYelTnhwtmnQKY03CFV3jnDO1TsyX/awVo0A== X-Gm-Gg: ASbGnculWp5iIZRsqynUVC2aV57uGouOpxzKMbLWnKPkV/CFa2BZx6Wx7IyExKVpf3k eJMH7of9u8e81WfUjZTeKgj465wefrGPZThIzomSulO8+wLED9OCtZA2FBzDero28a4qEN2PqAE jHhXdZGgzG7n9Da2z2LegfKWBCnzkpEkjbtKSw2hQ3pvoMyEnf5B4FbWalzb4oqY8wHbXyg3KQA qoxInL0XOwsNLZpF+AI2xtSxJ0cByHiX3JDR079t3sp/sU+jdb/hjw7J9/IP6i6+NMvebHNVjtY 8Y9u/i/a3ZmYqWQjH44iLd4nYGcy4qBhwsSBF+tJUUoibYZ7fkaRJazXwaFUerJxPtfe+yrYsS3 L0SX/ZttB X-Google-Smtp-Source: AGHT+IFlullQQaIZZ5F1Sihehx5a4IpL4eQPlMPWp7iPTQSNQLGtfx9PS69ESe0dEILY9uRA3UIA/g== X-Received: by 2002:a5d:5987:0:b0:391:30b9:556c with SMTP id ffacd0b85a97d-39132d38c0cmr6790962f8f.21.1741473265069; Sat, 08 Mar 2025 14:34:25 -0800 (PST) Received: from fedora.localnet (2-230-139-124.ip202.fastwebnet.it. [2.230.139.124]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3912c103808sm10168929f8f.97.2025.03.08.14.34.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 08 Mar 2025 14:34:24 -0800 (PST) From: Vincenzo Pupillo <v.pupillo@HIDDEN> Date: Sat, 08 Mar 2025 23:34:22 +0100 Message-ID: <2652246.XAFRqVoOGU@fedora> In-Reply-To: <1c91f952-4cd8-417c-bdfc-20e080057ece@HIDDEN> References: <5658405.rdbgypaU67@fedora> <1c91f952-4cd8-417c-bdfc-20e080057ece@HIDDEN> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Received-SPF: pass client-ip=2a00:1450:4864:20::42c; envelope-from=v.pupillo@HIDDEN; helo=mail-wr1-x42c.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: 1.0 (+) X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -0.0 (/) In data sabato 8 marzo 2025 17:12:32 Ora standard dell=E2=80=99Europa centr= ale, Angelo=20 Graziosi ha scritto: > Ciao Vincenzo, >=20 > me too used sr-speedbar for years. Now I have built Emacs with your > patch and it looks good. Thanks. >=20 > Ciao, > Angelo. Grazie Angelo! Vincenzo
X-Loop: help-debbugs@HIDDEN Subject: bug#76789: 31.0.50; [PATCH] speedbar: New speedbar-window-mode Resent-From: Vincenzo Pupillo <v.pupillo@HIDDEN> Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> Resent-CC: bug-gnu-emacs@HIDDEN Resent-Date: Sat, 08 Mar 2025 22:35:02 +0000 Resent-Message-ID: <handler.76789.B76789.174147327524201 <at> debbugs.gnu.org> Resent-Sender: help-debbugs@HIDDEN X-GNU-PR-Message: followup 76789 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: 76789 <at> debbugs.gnu.org Cc: Angelo Graziosi <angelo.g0@HIDDEN> X-Debbugs-Original-To: 76789 <at> debbugs.gnu.org, bug-gnu-emacs@HIDDEN Received: via spool by 76789-submit <at> debbugs.gnu.org id=B76789.174147327524201 (code B ref 76789); Sat, 08 Mar 2025 22:35:02 +0000 Received: (at 76789) by debbugs.gnu.org; 8 Mar 2025 22:34:35 +0000 Received: from localhost ([127.0.0.1]:57123 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1tr2kc-0006IH-Kw for submit <at> debbugs.gnu.org; Sat, 08 Mar 2025 17:34:34 -0500 Received: from mail-wr1-x432.google.com ([2a00:1450:4864:20::432]:47201) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from <v.pupillo@HIDDEN>) id 1tr2kZ-0006Hx-OK for 76789 <at> debbugs.gnu.org; Sat, 08 Mar 2025 17:34:32 -0500 Received: by mail-wr1-x432.google.com with SMTP id ffacd0b85a97d-390edaee0cfso2120971f8f.2 for <76789 <at> debbugs.gnu.org>; Sat, 08 Mar 2025 14:34:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1741473265; x=1742078065; darn=debbugs.gnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=KQVzPwWfyXKRS0IN0fVwEke8dpwh5h3oQL45nhWNT2c=; b=BdjJnwtuRn4aLAjGm5DT6wA7UzpbCOv0nb0oTRLPgCx5rN0wFWEMDBpz9NGfmbKMmL UHHIrzzTesLtL3Oj+TXECRB6FjIeyzxIkI5AP7b2QwHxk4icnizq0sMsGQPZybRnNgkg Uz7NEafReoPMgiUi3iX29Gb6Q7pK0wWJMAycthknXJCEOgaGVUktbNx+l4R4WTsctw5i fa0FvcKTGTf1kbhNtq86wijIkZamW9dnqF7nV0c3ID+Ha7k+aYVW8WUflnYtOrKUC0kQ cMgFcVyrV+EKkzGATaKd1/b97l9b2/I4MXD65C9Aiv9xwPTcs6gWQTZTJg8fiAkEp1Ru JFww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1741473265; x=1742078065; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=KQVzPwWfyXKRS0IN0fVwEke8dpwh5h3oQL45nhWNT2c=; b=CciXy7X1UzzwwzgApU2gIwzVaUN0CpuuFPkP1+4vYHCk2KaKbvEFXIvcYOdzIhLu8k 3MmbncBYM8npf2mZsQSbRfD1rnFo2hv3M2e7wOUK5SrXinffNwnRFS3Qp2khr6WyTXxg TA2V/PlkiUW8h1lwxydlTExlvLwe1HSe2QtcEtXAWd/uH/MRKEwHJt0q0n8c3ajwTuzi XYU3cGPdfdAzO23NfMz4HvmY0PR3zqb/0Qqh2UygPh8bD3gBq/9S4CoGluR6WKSrx777 T7o0Csn7yIqU12egfa//Q2/ANa1xF0WYVOtYUJtymLyoTAVeolByEeQpVMawceLw6lFH xZFQ== X-Gm-Message-State: AOJu0YzRTsgoMb7yRWgIcsGYv3C4U6x9CFgw98NxbVQTAY8uu0tDmXTX Y59LTK4qXjD/iaUd67lblud4OlZqnRDMmvbVqlEiURVgrMrlZyfm9N1Wbg== X-Gm-Gg: ASbGncvQDd8Zygxllie1gcHbFiE7g6vLjeXA9jbJcwXsa1+jbiM5INiXgMpHklkmccw UN/RctMd/jG1IU8VCPMFc4yoEOT3/ZRsqT2MC7nzIR/rWKgv+1cit4x5BnT59absURkqxmVIz4l rrprIif8E7vBg8v5JufpkDs6t4P8zaV43knmtFn79+gfJK01iz+L7nn0FYuwz7LRwpbe+ssRrLf 3C/rUH/5bqzSsQryWolVxw0txeOoh/45235DMUqDObhp3TmgxBha2ZAZXf9FRz8UFhJVZzhUWsp G5Gr+i9KLV9RcCU91noUyPMG17JNymU2VyjF9WFJNIU0YugiICJ2ncOqHtHtTAe6igaup2vYU7D lEOFF9E/D X-Google-Smtp-Source: AGHT+IFlullQQaIZZ5F1Sihehx5a4IpL4eQPlMPWp7iPTQSNQLGtfx9PS69ESe0dEILY9uRA3UIA/g== X-Received: by 2002:a5d:5987:0:b0:391:30b9:556c with SMTP id ffacd0b85a97d-39132d38c0cmr6790962f8f.21.1741473265069; Sat, 08 Mar 2025 14:34:25 -0800 (PST) Received: from fedora.localnet (2-230-139-124.ip202.fastwebnet.it. [2.230.139.124]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3912c103808sm10168929f8f.97.2025.03.08.14.34.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 08 Mar 2025 14:34:24 -0800 (PST) From: Vincenzo Pupillo <v.pupillo@HIDDEN> Date: Sat, 08 Mar 2025 23:34:22 +0100 Message-ID: <2652246.XAFRqVoOGU@fedora> In-Reply-To: <1c91f952-4cd8-417c-bdfc-20e080057ece@HIDDEN> References: <5658405.rdbgypaU67@fedora> <1c91f952-4cd8-417c-bdfc-20e080057ece@HIDDEN> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -1.0 (-) In data sabato 8 marzo 2025 17:12:32 Ora standard dell=E2=80=99Europa centr= ale, Angelo=20 Graziosi ha scritto: > Ciao Vincenzo, >=20 > me too used sr-speedbar for years. Now I have built Emacs with your > patch and it looks good. Thanks. >=20 > Ciao, > Angelo. Grazie Angelo! Vincenzo
X-Loop: help-debbugs@HIDDEN Subject: bug#76789: 31.0.50; [PATCH] speedbar: New speedbar-window-mode Resent-From: Eli Zaretskii <eliz@HIDDEN> Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> Resent-CC: bug-gnu-emacs@HIDDEN Resent-Date: Sun, 09 Mar 2025 06:55:01 +0000 Resent-Message-ID: <handler.76789.B76789.174150324430714 <at> debbugs.gnu.org> Resent-Sender: help-debbugs@HIDDEN X-GNU-PR-Message: followup 76789 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Vincenzo Pupillo <v.pupillo@HIDDEN> Cc: 76789 <at> debbugs.gnu.org Received: via spool by 76789-submit <at> debbugs.gnu.org id=B76789.174150324430714 (code B ref 76789); Sun, 09 Mar 2025 06:55:01 +0000 Received: (at 76789) by debbugs.gnu.org; 9 Mar 2025 06:54:04 +0000 Received: from localhost ([127.0.0.1]:57860 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1trAXz-0007zK-PP for submit <at> debbugs.gnu.org; Sun, 09 Mar 2025 01:54:04 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:50394) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1trAXx-0007yO-9L for 76789 <at> debbugs.gnu.org; Sun, 09 Mar 2025 01:54:01 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <eliz@HIDDEN>) id 1trAXr-00056P-4H; Sun, 09 Mar 2025 01:53:55 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=qFdd/KdrMqbiRctAoXTStSdpqULW+angUjuo8++15rU=; b=nz/EAse2reDJ pifwELgq0fYDNpxEUcvtAymJuw3JrWXoDZ5J01OX7ccBxG4bSGT66e+pvRlB6RUtbcxQphlgg9QnO 65SGQxrH7mssSz78cR+Xa26CLd3D7bLOk6JjkhCuEXp9fXqotglXfShbKKH7uHf1mc6hx1owM4nfp tDL5xJRsTF+u0nk4V525azHfw2hj0TbYLyMFY4d1iqj1zgu9TBaWPJL+XrYXUgeSSsJjv7H1ChoZv ayrKs7lU6Ex/MiI/aOQxIxTFafmx2/qVpgQPOt8Aq5fHDPSLMyrDlojcD6y/VgJDAMo+ShyxQyaB6 a7Ssej5z75aXVefUai5lIw==; Date: Sun, 09 Mar 2025 08:53:50 +0200 Message-Id: <86bjuaitj5.fsf@HIDDEN> From: Eli Zaretskii <eliz@HIDDEN> In-Reply-To: <5050698.OV4Wx5bFTl@fedora> (message from Vincenzo Pupillo on Sat, 08 Mar 2025 23:06:13 +0100) References: <5658405.rdbgypaU67@fedora> <86wmd1l4gg.fsf@HIDDEN> <5050698.OV4Wx5bFTl@fedora> X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -3.3 (---) > From: Vincenzo Pupillo <v.pupillo@HIDDEN> > Cc: 76789 <at> debbugs.gnu.org > Date: Sat, 08 Mar 2025 23:06:13 +0100 > > > Speedbar has its own manual. Did you consider updating that manual > > with this new feature? > I wrote something in speedbar.texi (not included in this patch), but I also > saw that the emacs manual has section 18.9 Speedbar Frame (chapter 18 Frames > and Graphical Display), and I am not sure how to edit it. Just add short text there saying that speedbar can optionally be displayed as a window, not a frame. That section has a reference to the Speedbar manual, so the details are covered by that. Thanks. Please see a few more comments below. > +*** The new command 'speedbar-window-mode' open Speedbar in a window instead > +of a frame. ^^^^ "opens" > +*** New alias 'speedbar-window' is an alias for 'speedbar-window-mode'. "New command 'speedbar-window' is an alias for 'speedbar-window-mode'." > +*** The new user option 'speedbar-prefer-window', tell 'speedbar' to open > +a side window instead of a frame. ^^^^ "tells" > +(defcustom speedbar-prefer-window nil > + "If t, the command `speedbar' open the speedbar in a window." ^^^^ "opens" > +(defcustom speedbar-window-dedicated-window t > + "Make the `speedbar-window' dedicated." "Whether to make the `speedbar-window' dedicated." > + :group 'speedbar > + :type 'boolean > + :version "31.1") > + > +(defcustom speedbar-window-side 'left > + "Show the `speedbar-window' on the `left', `right', `top' or `bottom'. > +See `display-buffer-in-side-window' for more details." Our style is to make the first line of the doc string a kind of summary: "Control the side of the frame on which to show the speedbar window. The value can be `left', `right', `top' or `bottom'. See `display-buffer-in-side-window' for more details." > +(defcustom speedbar-window-default-width 20 > + "Initial width in characters of `speedbar-window' under window system. Why "under window system"? Doesn't this work on TTY frames in the same way? > +(defcustom speedbar-window-max-width 40 > + "The maximum allowed width in characters of the `speedbar-window'." This begs the question: what happens with wider items? I suggest to tell that in the doc string. > +(defun speedbar-easymenu-definition-trailer () > + "Menu items appearing at the end of the speedbar menu." I guess you meant "Return menu items appearing..."? > +A nil ARG means toggle. If `speedbar-prefer-window' is t, open the > +speedbar in a window istead of in a frame." ^^^^^^^^^^^^^^^^^^^^ "...instead of in a separate frame" is better here, because any Emacs display is always "in a frame", even if it's in some window. > +(defun speedbar-is-frame-or-window-p () This function is not a predicate, since its value is not a boolean. So its name should be something like speedbar-frame-or-window, without "is" and without "-p". > +(defun speedbar-window-mode (&optional arg) > + "Enable or disable speedbar window. I suggest Enable or disable speedbar window mode. or "Enable or disable speedbar display in a separate window. > +(defsubst speedbar-window--window-live-p () > + "Return non-nil if `speedbar--window' is defined and live." ^^ Excess whitespace there. > +(defsubst speedbar-window--buffer-live-p () > + "Return non-nil `speedbar-buffer' is defined and live." ^^ "if" is missing there. Also, what do you mean by "buffer is defined"? I suggest to remove it and leave only "buffer is live". > +(defun speedbar-window--live-p () > + "Return t if `speedbar-window' is opened." ^^^^^^^^^ I suggest "is live" or "is displayed". > +(defsubst speedbar-window-current-window () > + "Return t if the current windows is the `speedbar--window'." "Return t if the selected window is the `speedbar--window'." > +(defsubst speedbar-window--width () > + "Return the width of `speedbar-window' WINDOW." ^^^^^^ This function has no argument named WINDOW. > +(defun speedbar-width () > + "Returns the width of the `speedbar'. ^^^^^^^ "Return" > +(defun speedbar--speedbar-live-p () > + "Return non-nil if `speedbar-window-mode' or `speedbar-frame-mode' are open." ^^^^^^^^^ "are active", I think?
X-Loop: help-debbugs@HIDDEN Subject: bug#76789: 31.0.50; [PATCH] speedbar: New speedbar-window-mode Resent-From: Vincenzo Pupillo <v.pupillo@HIDDEN> Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> Resent-CC: bug-gnu-emacs@HIDDEN Resent-Date: Tue, 11 Mar 2025 15:42:01 +0000 Resent-Message-ID: <handler.76789.B76789.17417076962895 <at> debbugs.gnu.org> Resent-Sender: help-debbugs@HIDDEN X-GNU-PR-Message: followup 76789 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Eli Zaretskii <eliz@HIDDEN> Cc: 76789 <at> debbugs.gnu.org Received: via spool by 76789-submit <at> debbugs.gnu.org id=B76789.17417076962895 (code B ref 76789); Tue, 11 Mar 2025 15:42:01 +0000 Received: (at 76789) by debbugs.gnu.org; 11 Mar 2025 15:41:36 +0000 Received: from localhost ([127.0.0.1]:45070 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1ts1ja-0000kb-Mm for submit <at> debbugs.gnu.org; Tue, 11 Mar 2025 11:41:36 -0400 Received: from mail-wm1-x32a.google.com ([2a00:1450:4864:20::32a]:44351) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from <v.pupillo@HIDDEN>) id 1ts1jW-0000kL-Mi for 76789 <at> debbugs.gnu.org; Tue, 11 Mar 2025 11:41:32 -0400 Received: by mail-wm1-x32a.google.com with SMTP id 5b1f17b1804b1-43cfe574976so12770345e9.1 for <76789 <at> debbugs.gnu.org>; Tue, 11 Mar 2025 08:41:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1741707684; x=1742312484; darn=debbugs.gnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=NeUBEfPxzatJUp08/Apri3A6WZgNQjC3iEislTzYTBw=; b=XF5AUsJmgMFlqoBn5aS5aVrlGgRJUhHogqFU7lZQsEVJcYuUmaBmA07bvTj6EV4tDn 05hR81Zs+Y+xjm7WOj7yldn7qw90q+rN3M5NaU4oDwBQ9LuFEu5IDQUS6/0hpZEiLk4Y NKWFrpmY1QU8bxXxdL50KDFk06VJXCX/Hj9vGJQPQm0TFW+LesnWc5HYnzSU2ZpYIzIs X5yELAXGhQXX5VLRRXgtl7DouKxz0cGSUPP9OMNtjMwL4BZO0z0sROzg74e3lXkA/yNq 1XSpcq2TgFOt4hnBv6Okn9cevi8+m8TWzmN+7G82er8TBM3BBZyFp0qvHxSpk0HmDB3o Cv9g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1741707684; x=1742312484; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=NeUBEfPxzatJUp08/Apri3A6WZgNQjC3iEislTzYTBw=; b=JRZID6kdB+l5C/Xwd4XyPV4f2iceLdH3fwXoR+ZBwQY+WwAqh1BmIFWVNajSrnEGex Fk3T33YoJhEdhSQuN8Sw8TJbk4UPTEkZHKl8wxra2G2ktgmEAFXNIL57wabqV4gzlTZL 2CuvMEQjBQXWCAkuM5+pADWINtFSvpK8icu8ts0wI7ZRryqZ/tUrh3WFRiSpsb2D+Cag 9sGOypOv+B1phGhsUBCXDpsKgjhWSBeXbkRuBV1sS3gG4GaRkT/SS5JKoZerVhnaQ9P0 mUa3C+kO8LdUwz+49RGLFwCtLSDcpcQc1ZgmXm1qxrkcU9OIc/P+Peh+1bftWRaNhC/d n8Zw== X-Gm-Message-State: AOJu0YwbLsJDeN4g4UTDds5zCoxyKQVK6tAOr9zMluz/Zey2267ay2Pt 07hBT8BLTmVgVQMFfAK4JDE6WwFNwLiDeDz5MX+xnPkmj4W7r1MZ X-Gm-Gg: ASbGncu9g1gcsElqZ/2tUtKshDkDMJ8V5mtQm3ajSb2mogqb9v/Pywx/sFFCOWo5GYc 7dsjRGIDXVDJVZ1RfUiBwAtwv2qFYEB4MncHAsP5T6u7rh2OIcVJS+JyXX4v+uAIM0a3KknL8PE Bhs0Ycdu55aQrRWPo2Bbn5Vw5EK4Vbta1p6r8Megu7fyY4WbaEnMpFwiHyArYEW/txip6yKacw6 Ypxy3FJUSPxoWsEDdWQdDfGARja8rKIJRZG/dR9dA6J4wIMZN3qkD1Ijd5DMANO2TCo02TsilEC eRRs8OAIzDyVO00TY1FMnoeqE4IqB1QXCQo9wFRJUzGKsY1snJOWrpDJzZYpQthefulArKV6IA= = X-Google-Smtp-Source: AGHT+IHzgAPv8RaI0NziPyQjDJr5EVENykyrsi2C6OcW3g2rLOTAuWTZcO4BNZzcM8+CmRLT0F3qJg== X-Received: by 2002:a05:600c:3542:b0:43c:ec4c:25b4 with SMTP id 5b1f17b1804b1-43d01bdbc01mr60913645e9.10.1741707683996; Tue, 11 Mar 2025 08:41:23 -0700 (PDT) Received: from 3-191.divsi.unimi.it (3-191.divsi.unimi.it. [159.149.3.191]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-43ce715731csm124804475e9.2.2025.03.11.08.41.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Mar 2025 08:41:23 -0700 (PDT) From: Vincenzo Pupillo <v.pupillo@HIDDEN> Date: Tue, 11 Mar 2025 16:41:22 +0100 Message-ID: <2838722.lGaqSPkdTl@HIDDEN> In-Reply-To: <86bjuaitj5.fsf@HIDDEN> References: <5658405.rdbgypaU67@fedora> <5050698.OV4Wx5bFTl@fedora> <86bjuaitj5.fsf@HIDDEN> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="nextPart2652540.XAFRqVoOGU" Content-Transfer-Encoding: 7Bit X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -1.0 (-) This is a multi-part message in MIME format. --nextPart2652540.XAFRqVoOGU Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Thank you Eli.=20 In this updated version of the patch I corrected what you indicated and add= ed=20 something in the manual, rather short :-(. Thanks. Vincenzo In data domenica 9 marzo 2025 07:53:50 Ora standard dell=E2=80=99Europa cen= trale, Eli=20 Zaretskii ha scritto: > > From: Vincenzo Pupillo <v.pupillo@HIDDEN> > > Cc: 76789 <at> debbugs.gnu.org > > Date: Sat, 08 Mar 2025 23:06:13 +0100 > >=20 > > > Speedbar has its own manual. Did you consider updating that manual > > > with this new feature? > >=20 > > I wrote something in speedbar.texi (not included in this patch), but I > > also > > saw that the emacs manual has section 18.9 Speedbar Frame (chapter 18 > > Frames and Graphical Display), and I am not sure how to edit it. >=20 > Just add short text there saying that speedbar can optionally be > displayed as a window, not a frame. That section has a reference to > the Speedbar manual, so the details are covered by that. >=20 > Thanks. Please see a few more comments below. >=20 > > +*** The new command 'speedbar-window-mode' open Speedbar in a window > > instead +of a frame. ^^^^ >=20 > "opens" >=20 > > +*** New alias 'speedbar-window' is an alias for 'speedbar-window-mode'. >=20 > "New command 'speedbar-window' is an alias for 'speedbar-window-mode'." >=20 > > +*** The new user option 'speedbar-prefer-window', tell 'speedbar' to o= pen > > +a side window instead of a frame. ^^^^ >=20 > "tells" >=20 > > +(defcustom speedbar-prefer-window nil > > + "If t, the command `speedbar' open the speedbar in a window." >=20 > ^^^^ > "opens" >=20 > > +(defcustom speedbar-window-dedicated-window t > > + "Make the `speedbar-window' dedicated." >=20 > "Whether to make the `speedbar-window' dedicated." >=20 > > + :group 'speedbar > > + :type 'boolean > > + :version "31.1") > > + > > +(defcustom speedbar-window-side 'left > > + "Show the `speedbar-window' on the `left', `right', `top' or `bottom= '. > > +See `display-buffer-in-side-window' for more details." >=20 > Our style is to make the first line of the doc string a kind of > summary: >=20 > "Control the side of the frame on which to show the speedbar window. > The value can be `left', `right', `top' or `bottom'. > See `display-buffer-in-side-window' for more details." >=20 > > +(defcustom speedbar-window-default-width 20 > > + "Initial width in characters of `speedbar-window' under window syste= m. >=20 > Why "under window system"? Doesn't this work on TTY frames in the > same way? >=20 > > +(defcustom speedbar-window-max-width 40 > > + "The maximum allowed width in characters of the `speedbar-window'." >=20 > This begs the question: what happens with wider items? I suggest to > tell that in the doc string. >=20 > > +(defun speedbar-easymenu-definition-trailer () > > + "Menu items appearing at the end of the speedbar menu." >=20 > I guess you meant "Return menu items appearing..."? >=20 > > +A nil ARG means toggle. If `speedbar-prefer-window' is t, open the > > +speedbar in a window istead of in a frame." >=20 > ^^^^^^^^^^^^^^^^^^^^ > "...instead of in a separate frame" is better here, because any Emacs > display is always "in a frame", even if it's in some window. >=20 > > +(defun speedbar-is-frame-or-window-p () >=20 > This function is not a predicate, since its value is not a boolean. > So its name should be something like speedbar-frame-or-window, without > "is" and without "-p". >=20 > > +(defun speedbar-window-mode (&optional arg) > > + "Enable or disable speedbar window. >=20 > I suggest >=20 > Enable or disable speedbar window mode. >=20 > or >=20 > "Enable or disable speedbar display in a separate window. >=20 > > +(defsubst speedbar-window--window-live-p () > > + "Return non-nil if `speedbar--window' is defined and live." >=20 > ^^ > Excess whitespace there. >=20 > > +(defsubst speedbar-window--buffer-live-p () > > + "Return non-nil `speedbar-buffer' is defined and live." >=20 > ^^ > "if" is missing there. Also, what do you mean by "buffer is defined"? > I suggest to remove it and leave only "buffer is live". >=20 > > +(defun speedbar-window--live-p () > > + "Return t if `speedbar-window' is opened." >=20 > ^^^^^^^^^ > I suggest "is live" or "is displayed". >=20 > > +(defsubst speedbar-window-current-window () > > + "Return t if the current windows is the `speedbar--window'." >=20 > "Return t if the selected window is the `speedbar--window'." >=20 > > +(defsubst speedbar-window--width () > > + "Return the width of `speedbar-window' WINDOW." >=20 > ^^^^^^ > This function has no argument named WINDOW. >=20 > > +(defun speedbar-width () > > + "Returns the width of the `speedbar'. >=20 > ^^^^^^^ > "Return" >=20 > > +(defun speedbar--speedbar-live-p () > > + "Return non-nil if `speedbar-window-mode' or `speedbar-frame-mode' a= re > > open." > =20 > ^^^^^^^^^ >=20 > "are active", I think? --nextPart2652540.XAFRqVoOGU Content-Disposition: attachment; filename="0001-Add-a-new-command-speedbar-window.patch" Content-Transfer-Encoding: 7Bit Content-Type: text/x-patch; charset="UTF-8"; name="0001-Add-a-new-command-speedbar-window.patch" From 5c47d10c5622c83246cd9503fc3771d3ae8e8797 Mon Sep 17 00:00:00 2001 From: Vincenzo Pupillo <vincenzo.pupillo@HIDDEN> Date: Thu, 6 Mar 2025 13:39:01 +0100 Subject: [PATCH] Add a new command `speedbar-window'. Speedbar now can be opened in a window instead of a separate frame. The frame remains the default. * doc/emacs/frames.texi: Mention Speedbar window mode. * doc/misc/speedbar.texi: Document 'speedbar-window'. * lisp/speedbar.el (speedbar-prefer-window): New user option. If t, the command `speedbar' open the speedbar in a window. (speedbar-window-dedicated-window): New user option. If t the window is dedicated. (speedbar-window-side): New user option. The side of 'speedbar-window', defaults to left. (speedbar-window-default-width): New user option. The default size of the 'speedbar-window'. (speedbar-window-max-width): New user option. Limits the width of the 'speedbar-window'. The user can resize the window as desired, but this option will be the width of the window when restored. (speedbar--buffer-name): New variable, the buffer name used for both 'speedbar-frame-mode' and 'speedbar-window-mode'. (speedbar--window): New variable, the window displaying 'speedbar-window'. (speedbar--window-width): New variable, store the current width of 'speedbar-window'. (speedbar-easymenu-definition-trailer): Now it is a function that returns a different trailer for 'speedbar-frame' and 'speedbar-window'. (speedbar): Now it is a function that calls 'speedbar-frame-mode', the default or 'speedbar-window-mode' based on the value of 'speedbar-prefer-window'. (speedbar-frame-mode): Before opening a frame, close 'speedbar-window' if it is open. (speedbar-frame-or-window): New function, returns 'frame', 'window' or nil if speedbar is not open. (speedbar-window): New alias for 'speedbar-window-mode'. (speedbar-window-mode): Enable of disable 'speedbar-window'. (speedbar-window--window-live-p): New function, return non-nil if the 'speedbar-window' is live. (speedbar-window--buffer-live-p): New function, return non-nil if the 'speedbar-buffer' is live. (speedbar-window--live-p): New function, return t if 'speedbar-window' is open. (speedbar-window-current-window): New function, return t if the selected window is speedbar-window. (speedbar-window--close): New function, close the 'speedbar-window'. (speedbar-window--width): New function, return the current width of 'speedbar-window'. (speedbar-width): New function, return the 'speedbar' of 'speedbar-frame-mode' of 'speedbar-frame-mode'. (speedbar-set-mode-line-format): Use the new 'speedbar-width' function. (speedbar-directory-buttons): Use the new 'speedbar-width' function. (speedbar--speedbar-live-p): New function, returns t if 'speedbar-frame-mode' or 'speedbar-window-mode' are open. (speedbar-timer-fn): Now handle 'speedbar-frame-mode' and 'speedbar-window-mode'. --- doc/emacs/frames.texi | 3 + doc/misc/speedbar.texi | 27 ++-- etc/NEWS | 13 ++ lisp/speedbar.el | 303 ++++++++++++++++++++++++++++++++++------- 4 files changed, 286 insertions(+), 60 deletions(-) diff --git a/doc/emacs/frames.texi b/doc/emacs/frames.texi index 9992c39dcc9..1fa6e0b5b33 100644 --- a/doc/emacs/frames.texi +++ b/doc/emacs/frames.texi @@ -964,6 +964,9 @@ Speedbar files, and lets you move the current message to another Rmail file by clicking on its @samp{<M>} box. +The speedbar can optionally be displayed as a window rather than a +separate frame, in both terminal and graphics mode. + For more details on using and programming the speedbar, @xref{Top, Speedbar,,speedbar, Speedbar Manual}. diff --git a/doc/misc/speedbar.texi b/doc/misc/speedbar.texi index 69c54f5b552..5029ad7138e 100644 --- a/doc/misc/speedbar.texi +++ b/doc/misc/speedbar.texi @@ -46,11 +46,11 @@ Top is the ``explorer'' often used in modern development environments, office packages, and web browsers. -Speedbar displays a narrow frame in which a tree view is shown. This -tree view defaults to containing a list of files and directories. Files -can be ``expanded'' to list tags inside. Directories can be expanded to -list the files within them. Each file or tag can be jumped to -immediately. +Speedbar displays a narrow frame or a narrow window in which a tree view +is shown. This tree view defaults to containing a list of files and +directories. Files can be ``expanded'' to list tags inside. +Directories can be expanded to list the files within them. Each file or +tag can be jumped to immediately. Speedbar expands upon ``explorer'' windows by maintaining context with the user. For example, when using the file view, the current buffer's file @@ -114,6 +114,16 @@ Introduction @code{speedbar-get-focus}. This function will toggle between frames, and it's useful to bind it to a key in terminal mode. @xref{Customizing}. +@cindex @code{speedbar-window} +Optionally, the speedbar can be displayed as a window, splitting the +windows of the selected frame, in both terminal and graphics modes. +Only one speedbar window can be open at a time. + +It is possible to switch from displaying the speedbar in a separate +frame to displaying it in a window and vice versa simply by using the +@kbd{M-x speedbar-window @key{RET}} or +@kbd{M-x speedbar-frame@key{RET}} command. + @node Basic Navigation @chapter Basic Navigation @@ -138,10 +148,11 @@ Basic Key Bindings @table @kbd @item Q @cindex quitting speedbar -Quit speedbar, and kill the frame. +Quit speedbar, and kill the frame. This is only available for +@code{speed-frame}. @item q -Quit speedbar, and hide the frame. This makes it faster to restore the -speedbar frame, than if you press @kbd{Q}. +Quit speedbar, and hide the frame or close the window. This makes it +faster to restore the speedbar frame, than if you press @kbd{Q}. @item g @cindex refresh speedbar display Refresh whatever contents are in speedbar. diff --git a/etc/NEWS b/etc/NEWS index ef4cacb20f9..a2c2a27c51a 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -1375,6 +1375,19 @@ Major-mode authors can customize the variables 'yank-media-autoselect-function' and/or 'yank-media-preferred-types' to change the selection rules. +** Speedbar + +--- +*** The new command 'speedbar-window-mode' opens Speedbar in a window instead +of a frame. + +*** New command 'speedbar-window' is an alias for 'speedbar-window-mode'. +' +*** The new user option 'speedbar-prefer-window', tells 'speedbar' to open +a side window instead of a frame. + +*** 'speedbar-easymenu-definition-trailer' is now a function. + ** Miscellaneous --- diff --git a/lisp/speedbar.el b/lisp/speedbar.el index 104e23b9bc9..3f53b5d41af 100644 --- a/lisp/speedbar.el +++ b/lisp/speedbar.el @@ -22,9 +22,9 @@ ;;; Commentary: ;; -;; The speedbar provides a frame in which files, and locations in -;; files are displayed. These items can be clicked on with mouse-2 in -;; to display that file location. +;; The speedbar provides a frame or a window in which files, and +;; locations in files are displayed. These items can be clicked on with +;; mouse-2 in to display that file location. ;; ;;; Customizing and Developing for speedbar ;; @@ -139,8 +139,58 @@ speedbar-use-images :version "21.1" :type 'boolean) +(defcustom speedbar-prefer-window nil + "If t, the command `speedbar' opens the speedbar in a window." + :type 'boolean + :group 'speedbar + :version "31.1") + +(defcustom speedbar-window-dedicated-window t + "Whether to make the `speedbar-window' dedicated." + :group 'speedbar + :type 'boolean + :version "31.1") + +(defcustom speedbar-window-side 'left + "Control the side of the frame on which to show the speedbar window. +The value can be `left', `right', `top' or `bottom'. +See `display-buffer-in-side-window' for more details." + :type '(radio (const :tag "Left" left) + (const :tag "Right" right) + (const :tag "Top" top) + (const :tag "Bottom" bottom)) + :group 'speedbar + :version "31.1") + +(defcustom speedbar-window-default-width 20 + "Initial width in characters of `speedbar-window'. +Specified the desired width when `speedbar-window' is opened on the left or +right side. The default value is the same width of `speedbar-frame-mode'." + :type 'integer + :group 'speedbar + :version "31.1") + +(defcustom speedbar-window-max-width 40 + "The maximum allowed width in characters of the `speedbar-window'. +The `speedbar-window' width can exceed the value defined here, however +if the window is closed and then reopened, this will be the width of the +`speedbar-window'." + :type 'integer + :group 'speedbar + :version "31.1") + ;;; Code: +(defconst speedbar--buffer-name " SPEEDBAR" + "Speedbar buffer name.") + +(defvar speedbar--window nil + "The window displaying `speedbar-window'.") + +(defvar speedbar--window-width speedbar-window-default-width +"Stores the current width of `speedbar-window'. +Subsequent calls to `speedbar-window' will open a window of this width.") + (defvar speedbar-initial-expansion-mode-alist '(("buffers" speedbar-buffer-easymenu-definition speedbar-buffers-key-map speedbar-buffer-buttons) @@ -844,11 +894,18 @@ speedbar-easymenu-definition-special ) "Additional menu items while in file-mode.") -(defvar speedbar-easymenu-definition-trailer - '(["Customize..." speedbar-customize t] - ["Close" dframe-close-frame t] - ["Quit" delete-frame t]) - "Menu items appearing at the end of the speedbar menu.") +(defun speedbar-easymenu-definition-trailer () + "Return menu items appearing at the end of the speedbar menu." + (let ((type (speedbar-frame-or-window))) + (cond ((eq type 'frame) + '(["Customize..." speedbar-customize t] + ["Close" dframe-close-frame t] + ["Quit" delete-frame t])) + ((eq type 'window) + '(["Customize..." speedbar-customize t] + ["Close" + (lambda () (interactive) (speedbar-window--close)) + :keys "q" :active t]))))) (defvar speedbar-desired-buffer nil "Non-nil when speedbar is showing buttons specific to a special mode. @@ -891,7 +948,19 @@ 'speedbar-mode-line-update ;; ;;;###autoload -(defalias 'speedbar 'speedbar-frame-mode) +(defun speedbar (&optional arg) + "Open or close the `speedbar'. +Positive ARG means turn on, negative turn off. +A nil ARG means toggle. If `speedbar-prefer-window' is t, open the +speedbar in a window instead of in a separate frame." + (interactive "P") + (if speedbar-prefer-window + (speedbar-window-mode arg) + (speedbar-frame-mode arg))) + +;;;###autoload +(defalias 'speedbar-frame 'speedbar-frame-mode) + ;;;###autoload (defun speedbar-frame-mode (&optional arg) "Enable or disable speedbar. Positive ARG means turn on, negative turn off. @@ -901,10 +970,12 @@ speedbar-frame-mode `speedbar-before-popup-hook' is called before popping up the speedbar frame. `speedbar-before-delete-hook' is called before the frame is deleted." (interactive "P") + (when (eq (speedbar-frame-or-window) 'window) + (speedbar-window--close)) ;; Get the buffer to play with (if (not (buffer-live-p speedbar-buffer)) (with-current-buffer - (setq speedbar-buffer (get-buffer-create " SPEEDBAR")) + (setq speedbar-buffer (get-buffer-create speedbar--buffer-name)) (speedbar-mode))) ;; Do the frame thing (dframe-frame-mode arg @@ -934,6 +1005,115 @@ speedbar-frame-mode (message (substitute-command-keys "Use \\[speedbar-get-focus] to see the speedbar window")))) +(defun speedbar-frame-or-window () + "Return 'frame' of 'window' if one of each are open. +Return nil if both are closed." + (cond + ((speedbar-window--live-p) + 'window) + ((and (frame-live-p (speedbar-current-frame)) + speedbar-buffer + (not (speedbar-window--live-p))) + 'frame) + (t nil))) + +;;;###autoload +(defalias 'speedbar-window 'speedbar-window-mode) +;;;###autoload +(defun speedbar-window-mode (&optional arg) + "Enable or disable speedbar window mode. +Positive ARG means turn on, negative turn off. +A nil ARG means toggle. Once the speedbar window is activated, a buffer in +`speedbar-mode' will be displayed. Currently, only one speedbar is +supported at a time. +`speedbar-before-popup-hook' is called before popping up the speedbar frame. +`speedbar-before-delete-hook' is called before the frame is deleted." + (interactive "P") + (when (eq (speedbar-frame-or-window) 'frame) + (delete-frame (speedbar-current-frame))) + + (if (or (and (not arg) (speedbar-window--live-p)) + (and (numberp arg) (< arg 0))) + (speedbar-window--close) + (let ((current-window (selected-window))) + (unless (speedbar-window--buffer-live-p) + (setq speedbar-buffer (get-buffer-create speedbar--buffer-name))) + + (setq speedbar-frame (selected-frame) + dframe-attached-frame (selected-frame) + speedbar-select-frame-method 'attached + speedbar-last-selected-file nil) + + (set-buffer speedbar-buffer) + (speedbar-mode) + + ;; let's create the window + (setq speedbar--window + (display-buffer-in-side-window speedbar-buffer + `((side ,@speedbar-window-side) + (slot . 0) + (dedicated ,@speedbar-window-dedicated-window) + (window-width ,@speedbar--window-width)))) + ;; additional window parameters + (set-window-parameter speedbar--window 'no-other-window t) + (set-window-parameter speedbar--window 'no-delete-other-windows t) + + ;; `speedbar-reconfigure-keymaps' checks if the `speedbar-window' is open, so + ;; should stay after the buffer and window definition. + (speedbar-reconfigure-keymaps) + (speedbar-update-contents) + (speedbar-set-timer dframe-update-speed) + + ;; hscroll + (setq-local auto-hscroll-mode nil) + ;; reset the selection variable + (setq speedbar-last-selected-file nil) + (select-window current-window)))) + +(defsubst speedbar-window--window-live-p () + "Return non-nil if `speedbar--window' is defined and live." + (when (and speedbar--window (window-live-p speedbar--window)) + speedbar--window)) + +(defsubst speedbar-window--buffer-live-p () + "Return non-nil if `speedbar-buffer' is live." + (when (and speedbar-buffer (buffer-live-p speedbar-buffer)) + speedbar-buffer)) + +(defun speedbar-window--live-p () + "Return t if `speedbar-window' is live." + (and (speedbar-window--buffer-live-p) (speedbar-window--window-live-p))) + +(defsubst speedbar-window-current-window () + "Return t if the selected windows is the `speedbar--window'." + (eq (selected-window) speedbar--window)) + +(defun speedbar-window--close () + "Close `speedbar-window'." + (when (speedbar-window--live-p) + (let ((current-window (selected-window))) + ;; store the current window width + (setq speedbar--window-width + (let ((current-width (speedbar-window--width))) + (if (> current-width speedbar-window-max-width) + speedbar-window-max-width + current-width))) + + (delete-window speedbar--window) + (setq speedbar--window nil + speedbar-frame nil + dframe-attached-frame nil) + (speedbar-set-timer nil) + (kill-buffer speedbar-buffer) + (setq speedbar-buffer nil) + (when (and current-window (window-live-p current-window)) + (select-window current-window))))) + +(defsubst speedbar-window--width () + "Return the width of `speedbar-window'." + (let ((edges (window-edges speedbar--window))) + (- (nth 2 edges) (nth 0 edges)))) + (defun speedbar-frame-reposition-smartly () "Reposition the speedbar frame to be next to the attached frame." (cond ((or (assoc 'left speedbar-frame-parameters) @@ -980,6 +1160,14 @@ speedbar-frame-width Return nil if it doesn't exist." (frame-width speedbar-frame)) +(defun speedbar-width () + "Return the width of the `speedbar'. +if `speedbar-window-mode' is open, the width is `speedbar-window--width' +otherwise the width is `speedbar-frame-width'." + (if (speedbar-window--live-p) + (speedbar-window--width) + (speedbar-frame-width))) + (define-derived-mode speedbar-mode fundamental-mode "Speedbar" "Major mode for managing a display of directories and tags. \\<speedbar-mode-map> @@ -1066,7 +1254,7 @@ speedbar-set-mode-line-format (if (and (frame-live-p (speedbar-current-frame)) speedbar-buffer) (with-current-buffer speedbar-buffer - (let* ((w (or (speedbar-frame-width) 20)) + (let* ((w (or (speedbar-width) 20)) (p1 "<<") (p5 ">>") (p3 (if speedbar-update-flag "#" "!")) @@ -1128,7 +1316,7 @@ speedbar-reconfigure-keymaps (setq alist (cdr alist))) displays))) ;; The trailer - speedbar-easymenu-definition-trailer)) + (speedbar-easymenu-definition-trailer))) (localmap (save-excursion (let ((cf (selected-frame))) (prog2 @@ -1838,7 +2026,7 @@ speedbar-directory-buttons ;; Nuke the beginning of the directory if it's too long... (cond ((eq speedbar-directory-button-trim-method 'span) (beginning-of-line) - (let ((ww (or (speedbar-frame-width) 20))) + (let ((ww (or (speedbar-width) 20))) (move-to-column ww nil) (while (>= (current-column) ww) (re-search-backward "[/\\]" nil t) @@ -1854,7 +2042,7 @@ speedbar-directory-buttons (move-to-column ww nil))))) ((eq speedbar-directory-button-trim-method 'trim) (end-of-line) - (let ((ww (or (speedbar-frame-width) 20)) + (let ((ww (or (speedbar-width) 20)) (tl (current-column))) (if (< ww tl) (progn @@ -2525,56 +2713,67 @@ speedbar-set-timer ;; change this if it changed for some reason (speedbar-set-mode-line-format)) +(defun speedbar--speedbar-live-p () + "Return non-nil if `speedbar-window-mode' or `speedbar-frame-mode' are active." + (cond + ((and (speedbar-current-frame) + (frame-live-p (speedbar-current-frame))) + t) + ((speedbar-window--window-live-p) t) + (t nil))) + (defun speedbar-timer-fn () "Run whenever Emacs is idle to update the speedbar item." - (if (or (not (speedbar-current-frame)) - (not (frame-live-p (speedbar-current-frame)))) + (if (not (speedbar--speedbar-live-p)) (speedbar-set-timer nil) ;; Save all the match data so that we don't mess up executing fns (save-match-data ;; Only do stuff if the frame is visible, not an icon, and if ;; it is currently flagged to do something. (if (and speedbar-update-flag - (speedbar-current-frame) + (or (speedbar-window-current-window) + (speedbar-current-frame)) (frame-visible-p (speedbar-current-frame)) (not (eq (frame-visible-p (speedbar-current-frame)) 'icon))) (let ((af (selected-frame))) - (dframe-select-attached-frame speedbar-frame) - ;; make sure we at least choose a window to - ;; get a good directory from - (if (window-minibuffer-p) - nil - ;; Check for special modes - (speedbar-maybe-add-localized-support (current-buffer)) - ;; Update for special mode all the time! - (if (and speedbar-mode-specific-contents-flag - (consp speedbar-special-mode-expansion-list) - (local-variable-p - 'speedbar-special-mode-expansion-list - (current-buffer))) - ;;(eq (get major-mode 'mode-class 'special))) - (progn - (if (<= 2 speedbar-verbosity-level) + (dframe-select-attached-frame speedbar-frame) + ;; make sure we at least choose a window to + ;; get a good directory from + (if (window-minibuffer-p) + nil + ;; Check for special modes + (speedbar-maybe-add-localized-support (current-buffer)) + ;; Update for special mode all the time! + (if (and speedbar-mode-specific-contents-flag + (consp speedbar-special-mode-expansion-list) + (local-variable-p + 'speedbar-special-mode-expansion-list + (current-buffer))) + ;;(eq (get major-mode 'mode-class 'special))) + (progn + (if (<= 2 speedbar-verbosity-level) + (dframe-message + "Updating speedbar to special mode: %s..." + major-mode)) + (speedbar-update-special-contents) + (if (<= 2 speedbar-verbosity-level) + (progn (dframe-message - "Updating speedbar to special mode: %s..." - major-mode)) - (speedbar-update-special-contents) - (if (<= 2 speedbar-verbosity-level) - (progn - (dframe-message - "Updating speedbar to special mode: %s...done" - major-mode) - (dframe-message nil)))) - - ;; Update all the contents if directories change! - (unless (and (or (member major-mode speedbar-ignored-modes) - (eq af (speedbar-current-frame)) - (not (buffer-file-name))) - ;; Always update for GUD. - (not (string-equal "GUD" - speedbar-initial-expansion-list-name))) - (speedbar-update-localized-contents))) - (select-frame af)) + "Updating speedbar to special mode: %s...done" + major-mode) + (dframe-message nil)))) + + ;; Update all the contents if directories change! + (unless (and (or (member major-mode speedbar-ignored-modes) + (and + (eq af (speedbar-current-frame)) + (speedbar-window-current-window)) + (not (buffer-file-name))) + ;; Always update for GUD. + (not (string-equal "GUD" + speedbar-initial-expansion-list-name))) + (speedbar-update-localized-contents))) + (select-frame af)) ;; Now run stealthy updates of time-consuming items (speedbar-stealthy-updates))))) (run-hooks 'speedbar-timer-hook)) -- 2.48.1 --nextPart2652540.XAFRqVoOGU--
X-Loop: help-debbugs@HIDDEN Subject: bug#76789: 31.0.50; [PATCH] speedbar: New speedbar-window-mode Resent-From: Eli Zaretskii <eliz@HIDDEN> Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> Resent-CC: bug-gnu-emacs@HIDDEN Resent-Date: Thu, 13 Mar 2025 09:58:02 +0000 Resent-Message-ID: <handler.76789.B76789.17418598741843 <at> debbugs.gnu.org> Resent-Sender: help-debbugs@HIDDEN X-GNU-PR-Message: followup 76789 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Vincenzo Pupillo <v.pupillo@HIDDEN> Cc: 76789 <at> debbugs.gnu.org Received: via spool by 76789-submit <at> debbugs.gnu.org id=B76789.17418598741843 (code B ref 76789); Thu, 13 Mar 2025 09:58:02 +0000 Received: (at 76789) by debbugs.gnu.org; 13 Mar 2025 09:57:54 +0000 Received: from localhost ([127.0.0.1]:53808 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1tsfK5-0000Tf-U7 for submit <at> debbugs.gnu.org; Thu, 13 Mar 2025 05:57:54 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45160) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1tsfK2-0000TO-Cc for 76789 <at> debbugs.gnu.org; Thu, 13 Mar 2025 05:57:51 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <eliz@HIDDEN>) id 1tsfJw-0007PW-NU; Thu, 13 Mar 2025 05:57:44 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=UbnIA9uOmuCW3gq7dy5zaahiGBrp47uYAzgchrZQOW8=; b=SLCJWQ/anWZT AZNafXFYfa1iXb+3s/H7fg7na04vg/EDKslDZ468Nv+vVcBwTdQzerZxPObsqBxzGBZvMC7lae1uH 7Eq0n65wk0ZX7lHDY96RD7yqR6/sUckfjlaWMMoomigIUBaY9LNK4S+aRh+3GfNyb10nRlBAfR4UL 9zv4HrmJdHe5ut1YoyD9ZITIzLRULZTJ+7CTyLmFPUfZkHgCptV8hqVdPxsOZK64d3CCEjYUjRYyK FBeGEgDc2nHWc3l2ZNddjpK0FiTJimup1ltWnQ2oitdDzfXnG3TWIN0LuFC6EMVN7OkV2yFhs7Q8k RGNAMxDcnUIFww8Wl0GZyQ==; Date: Thu, 13 Mar 2025 11:57:41 +0200 Message-Id: <86r0312qy2.fsf@HIDDEN> From: Eli Zaretskii <eliz@HIDDEN> In-Reply-To: <2838722.lGaqSPkdTl@HIDDEN> (message from Vincenzo Pupillo on Tue, 11 Mar 2025 16:41:22 +0100) References: <5658405.rdbgypaU67@fedora> <5050698.OV4Wx5bFTl@fedora> <86bjuaitj5.fsf@HIDDEN> <2838722.lGaqSPkdTl@HIDDEN> X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -3.3 (---) > From: Vincenzo Pupillo <v.pupillo@HIDDEN> > Cc: 76789 <at> debbugs.gnu.org > Date: Tue, 11 Mar 2025 16:41:22 +0100 > > Thank you Eli. > In this updated version of the patch I corrected what you indicated and added > something in the manual, rather short :-(. Thanks. I meant to install it, but building Emacs after applying the changes yields warnings: In speedbar-frame-or-window: speedbar.el:1009:2: Warning: docstring has wrong usage of unescaped single quotes (use \=' or different quoting such as `...') In speedbar-window-mode: speedbar.el:1045:13: Warning: assignment to free variable `speedbar-select-frame-method' In speedbar-window--buffer-live-p: speedbar.el:1079:11: Warning: defsubst `speedbar-window--buffer-live-p' was used before it was defined In speedbar-window--width: speedbar.el:1113:11: Warning: defsubst `speedbar-window--width' was used before it was defined In speedbar-current-frame: speedbar.el:1135:11: Warning: defsubst `speedbar-current-frame' was used before it was defined Please fix those. Also, here: > +@cindex @code{speedbar-window} > +Optionally, the speedbar can be displayed as a window, splitting the > +windows of the selected frame, in both terminal and graphics modes. > +Only one speedbar window can be open at a time. > + > +It is possible to switch from displaying the speedbar in a separate > +frame to displaying it in a window and vice versa simply by using the > +@kbd{M-x speedbar-window @key{RET}} or > +@kbd{M-x speedbar-frame@key{RET}} command. please mention and index the user option you added. > +** Speedbar > + > +--- > +*** The new command 'speedbar-window-mode' opens Speedbar in a window instead > +of a frame. > + > +*** New command 'speedbar-window' is an alias for 'speedbar-window-mode'. > +' > +*** The new user option 'speedbar-prefer-window', tells 'speedbar' to open > +a side window instead of a frame. > + > +*** 'speedbar-easymenu-definition-trailer' is now a function. > + These NEWS entries should be marked with "+++", since this is now documented in the relevant manuals.
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997 nCipher Corporation Ltd,
1994-97 Ian Jackson.