unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#57081: 29.0.50; [PATCH] Point associated with Window for good reasons
@ 2022-08-09 12:01 dick.r.chiang
  2022-08-09 16:53 ` Eli Zaretskii
  2022-08-09 17:55 ` Lars Ingebrigtsen
  0 siblings, 2 replies; 18+ messages in thread
From: dick.r.chiang @ 2022-08-09 12:01 UTC (permalink / raw)
  To: 57081

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: 0001-window-point-is-a-thing.patch --]
[-- Type: text/x-diff, Size: 7115 bytes --]

From fc29004fe9287ce02eb3aa52abe5a4fc54834663 Mon Sep 17 00:00:00 2001
From: dickmao <dick.r.chiang@gmail.com>
Date: Tue, 9 Aug 2022 07:37:57 -0400
Subject: [PATCH] window-point is a thing

We regularly split the same buffer across two windows (C-x 2) and
position one window as a reference while manipulating the other.

When temporarily switching out one window, say to check a definition,
our flow gets wrecked by C-x b's refusal to flip back to the original
buffer since it's already displayed in another window, albeit, and
very importantly, at a different point (which to belabor things, is
the whole reason we want the same buffer in two windows).

I'm sure this has been proposed many times in the past, the
preservationist society being what it is.

* lisp/ido.el (ido-make-buffer-list-1): De-obfuscate.
(ido-make-buffer-list): Include visible buffer when switching.
(ido-get-buffers-in-frames): De-obfuscate.
* lisp/window.el (read-buffer-to-switch): Include visible buffer.
* test/lisp/ido-tests.el (ert-deftest): Test it.
---
 lisp/ido.el              | 43 +++++++++++++++++++---------------------
 lisp/window.el           |  2 +-
 test/lisp/ido-tests.el   | 21 ++++++++++++++++++++
 test/src/buffer-tests.el | 21 ++++++++++++++++++++
 4 files changed, 63 insertions(+), 24 deletions(-)

diff --git a/lisp/ido.el b/lisp/ido.el
index 134081d6759..5aeb8fcec51 100644
--- a/lisp/ido.el
+++ b/lisp/ido.el
@@ -3432,32 +3432,32 @@ ido-make-buffer-list-1
 	  (mapcar
 	   (lambda (x)
 	     (let ((name (buffer-name x)))
-	       (if (not (or (ido-ignore-item-p name ido-ignore-buffers) (member name visible)))
-		   name)))
+	       (and (not (ido-ignore-item-p name ido-ignore-buffers))
+                    (not (member name visible))
+	            name)))
 	   (buffer-list frame)))))
 
 (defun ido-make-buffer-list (default)
   "Return the current list of buffers.
-Currently visible buffers are put at the end of the list.
 The hook `ido-make-buffer-list-hook' is run after the list has been
 created to allow the user to further modify the order of the buffer names
 in this list.  If DEFAULT is non-nil, and corresponds to an existing buffer,
 it is put to the start of the list."
-  (let* ((ido-current-buffers (ido-get-buffers-in-frames 'current))
-	 (ido-temp-list (ido-make-buffer-list-1 (selected-frame) ido-current-buffers)))
-    (if ido-temp-list
-	(nconc ido-temp-list ido-current-buffers)
-      (setq ido-temp-list ido-current-buffers))
-    (if ido-predicate
-        (setq ido-temp-list (seq-filter
-                             (lambda (name)
-                               (funcall ido-predicate (cons name (get-buffer name))))
-                             ido-temp-list)))
-    (if default
-	(setq ido-temp-list
-	      (cons default (delete default ido-temp-list))))
-    (if (bound-and-true-p ido-enable-virtual-buffers)
-	(ido-add-virtual-buffers-to-list))
+  (let* ((current (buffer-name (window-buffer (selected-window))))
+         (ido-temp-list (ido-make-buffer-list-1 (selected-frame) (list current))))
+    (when (consp ido-temp-list)
+      (setcdr (last ido-temp-list) (list current)))
+    (when ido-predicate
+      (setq ido-temp-list
+            (seq-filter
+             (lambda (name)
+               (funcall ido-predicate (cons name (get-buffer name))))
+             ido-temp-list)))
+    (when default
+      (setq ido-temp-list
+	    (cons default (delete default ido-temp-list))))
+    (when (bound-and-true-p ido-enable-virtual-buffers)
+      (ido-add-virtual-buffers-to-list))
     (run-hooks 'ido-make-buffer-list-hook)
     ido-temp-list))
 
@@ -3723,11 +3723,8 @@ ido-get-buffers-in-frames
   "Return the list of buffers that are visible in the current frame.
 If optional argument CURRENT is given, restrict searching to the current
 frame, rather than all frames, regardless of value of `ido-all-frames'."
-  (let ((ido-bufs-in-frame nil))
-    (walk-windows 'ido-get-bufname nil
-		  (if current
-		      nil
-		    ido-all-frames))
+  (let (ido-bufs-in-frame)
+    (walk-windows 'ido-get-bufname nil (unless current ido-all-frames))
     ido-bufs-in-frame))
 
 (defun ido-get-bufname (win)
diff --git a/lisp/window.el b/lisp/window.el
index 4d88ffa9039..86996fe9730 100644
--- a/lisp/window.el
+++ b/lisp/window.el
@@ -8673,7 +8673,7 @@ read-buffer-to-switch
               (setq-local icomplete-with-completion-tables
                           (cons rbts-completion-table
                                 icomplete-with-completion-tables))))
-      (read-buffer prompt (other-buffer (current-buffer))
+      (read-buffer prompt (other-buffer (current-buffer) t)
                    (confirm-nonexistent-file-or-buffer)))))
 
 (defun window-normalize-buffer-to-switch-to (buffer-or-name)
diff --git a/test/lisp/ido-tests.el b/test/lisp/ido-tests.el
index 56ef6cde358..034071b52b3 100644
--- a/test/lisp/ido-tests.el
+++ b/test/lisp/ido-tests.el
@@ -51,4 +51,25 @@ ido-directory-too-big-p
   (let ((ido-big-directories (cons (rx "me/di") ido-big-directories)))
     (should (ido-directory-too-big-p "/some/dir/"))))
 
+(ert-deftest ido-buffer-switch-visible ()
+  "switch-to-buffer should include already visible buffers."
+  (let* ((name "test-buffer-switch-visible")
+         (buffer (get-buffer-create name)))
+    (unwind-protect
+        (progn
+          (switch-to-buffer buffer)
+          (delete-other-windows)
+          (split-window-below)
+          (goto-char (point-min))
+          (other-window 1)
+          (insert "foo")
+          (goto-char (point-max))
+          (cl-letf (((symbol-function 'read-from-minibuffer)
+                     (lambda (&rest args) (nth 5 args))))
+            (call-interactively #'ido-switch-buffer)
+            (call-interactively #'ido-switch-buffer))
+          (should (and (equal name (buffer-name)) (eq (point) (point-max)))))
+      (let (kill-buffer-query-functions)
+        (kill-buffer buffer)))))
+
 ;;; ido-tests.el ends here
diff --git a/test/src/buffer-tests.el b/test/src/buffer-tests.el
index 3c6a9208ffa..b34766c2383 100644
--- a/test/src/buffer-tests.el
+++ b/test/src/buffer-tests.el
@@ -1555,4 +1555,25 @@ test-buffer-chars-modified-ticks
       (if f2 (delete-file f2))
       )))
 
+(ert-deftest test-buffer-switch-visible ()
+  "switch-to-buffer should include already visible buffers."
+  (let* ((name "test-buffer-switch-visible")
+         (buffer (get-buffer-create name)))
+    (unwind-protect
+        (progn
+          (switch-to-buffer buffer)
+          (delete-other-windows)
+          (split-window-below)
+          (goto-char (point-min))
+          (other-window 1)
+          (insert "foo")
+          (goto-char (point-max))
+          (cl-letf (((symbol-function 'read-from-minibuffer)
+                     (lambda (&rest args) (nth 5 args))))
+            (call-interactively #'switch-to-buffer)
+            (call-interactively #'switch-to-buffer))
+          (should (and (equal name (buffer-name)) (eq (point) (point-max)))))
+      (let (kill-buffer-query-functions)
+        (kill-buffer buffer)))))
+
 ;;; buffer-tests.el ends here
-- 
2.36.1


[-- Attachment #2: Type: text/plain, Size: 13279 bytes --]




In Commercial Emacs 0.3.1snapshot f0a5a41 in dev (upstream 29.0.50, x86_64-pc-linux-gnu) built on dick
Repository revision: f0a5a41845236f05116b0a8459b5702e4d878b20
Repository branch: dev
Windowing system distributor 'The X.Org Foundation', version 11.0.12013000
System Description: Ubuntu 20.04.4 LTS

Configured using:
 'configure WERROR_CFLAGS=-Werror --prefix=/home/dick/.local
 --with-tree-sitter'
Configured features:
CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GSETTINGS HARFBUZZ JPEG JSON
TREE_SITTER LCMS2 LIBSELINUX LIBXML2 MODULES NOTIFY INOTIFY PDUMPER PNG
RSVG SECCOMP SOUND THREADS TIFF TOOLKIT_SCROLL_BARS WEBP X11 XDBE XIM
XINPUT2 XPM GTK3 ZLIB
Important settings:
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Magit

Minor modes in effect:
  global-git-commit-mode: t
  shell-dirtrack-mode: t
  projectile-mode: t
  flx-ido-mode: t
  override-global-mode: t
  global-hl-line-mode: t
  hl-line-mode: t
  winner-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  show-paren-mode: t
  mouse-wheel-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  buffer-read-only: t
  column-number-mode: t
  line-number-mode: t
  transient-mark-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t

Load-path shadows:
/home/dick/gomacro-mode/gomacro-mode hides /home/dick/.emacs.d/elpa/gomacro-mode-20200326.1103/gomacro-mode
/home/dick/.emacs.d/elpa/go-rename-20190805.2101/go-rename hides /home/dick/.emacs.d/elpa/go-mode-1.6.0/go-rename
/home/dick/.emacs.d/elpa/go-guru-20181012.330/go-guru hides /home/dick/.emacs.d/elpa/go-mode-1.6.0/go-guru
/home/dick/org-gcal.el/org-gcal hides /home/dick/.emacs.d/elpa/org-gcal-0.3/org-gcal
/home/dick/.emacs.d/elpa/request-deferred-0.2.0/request-deferred hides /home/dick/.emacs.d/elpa/request-0.3.3/request-deferred
/home/dick/.emacs.d/elpa/chess-2.0.5/_pkg hides /home/dick/.local/share/emacs/site-lisp/_pkg
/home/dick/.emacs.d/elpa/chess-2.0.5/chess-pos hides /home/dick/.local/share/emacs/site-lisp/chess-pos
/home/dick/.emacs.d/elpa/chess-2.0.5/chess-module hides /home/dick/.local/share/emacs/site-lisp/chess-module
/home/dick/.emacs.d/elpa/chess-2.0.5/chess-ucb hides /home/dick/.local/share/emacs/site-lisp/chess-ucb
/home/dick/.emacs.d/elpa/chess-2.0.5/chess-scid hides /home/dick/.local/share/emacs/site-lisp/chess-scid
/home/dick/.emacs.d/elpa/chess-2.0.5/chess-puzzle hides /home/dick/.local/share/emacs/site-lisp/chess-puzzle
/home/dick/.emacs.d/elpa/chess-2.0.5/chess-irc hides /home/dick/.local/share/emacs/site-lisp/chess-irc
/home/dick/.emacs.d/elpa/chess-2.0.5/chess-network hides /home/dick/.local/share/emacs/site-lisp/chess-network
/home/dick/.emacs.d/elpa/chess-2.0.5/chess-autosave hides /home/dick/.local/share/emacs/site-lisp/chess-autosave
/home/dick/.emacs.d/elpa/chess-2.0.5/chess-engine hides /home/dick/.local/share/emacs/site-lisp/chess-engine
/home/dick/.emacs.d/elpa/chess-2.0.5/chess-tutorial hides /home/dick/.local/share/emacs/site-lisp/chess-tutorial
/home/dick/.emacs.d/elpa/chess-2.0.5/chess-german hides /home/dick/.local/share/emacs/site-lisp/chess-german
/home/dick/.emacs.d/elpa/chess-2.0.5/chess-file hides /home/dick/.local/share/emacs/site-lisp/chess-file
/home/dick/.emacs.d/elpa/chess-2.0.5/chess-random hides /home/dick/.local/share/emacs/site-lisp/chess-random
/home/dick/.emacs.d/elpa/chess-2.0.5/chess-stockfish hides /home/dick/.local/share/emacs/site-lisp/chess-stockfish
/home/dick/.emacs.d/elpa/chess-2.0.5/chess-pgn hides /home/dick/.local/share/emacs/site-lisp/chess-pgn
/home/dick/.emacs.d/elpa/chess-2.0.5/chess-kibitz hides /home/dick/.local/share/emacs/site-lisp/chess-kibitz
/home/dick/.emacs.d/elpa/chess-2.0.5/chess-eco hides /home/dick/.local/share/emacs/site-lisp/chess-eco
/home/dick/.emacs.d/elpa/chess-2.0.5/chess-display hides /home/dick/.local/share/emacs/site-lisp/chess-display
/home/dick/.emacs.d/elpa/chess-2.0.5/chess-var hides /home/dick/.local/share/emacs/site-lisp/chess-var
/home/dick/.emacs.d/elpa/chess-2.0.5/chess-test hides /home/dick/.local/share/emacs/site-lisp/chess-test
/home/dick/.emacs.d/elpa/chess-2.0.5/chess-ply hides /home/dick/.local/share/emacs/site-lisp/chess-ply
/home/dick/.emacs.d/elpa/chess-2.0.5/chess-message hides /home/dick/.local/share/emacs/site-lisp/chess-message
/home/dick/.emacs.d/elpa/chess-2.0.5/chess-ics1 hides /home/dick/.local/share/emacs/site-lisp/chess-ics1
/home/dick/.emacs.d/elpa/chess-2.0.5/chess-phalanx hides /home/dick/.local/share/emacs/site-lisp/chess-phalanx
/home/dick/.emacs.d/elpa/chess-2.0.5/chess-game hides /home/dick/.local/share/emacs/site-lisp/chess-game
/home/dick/.emacs.d/elpa/chess-2.0.5/chess-log hides /home/dick/.local/share/emacs/site-lisp/chess-log
/home/dick/.emacs.d/elpa/chess-2.0.5/chess-plain hides /home/dick/.local/share/emacs/site-lisp/chess-plain
/home/dick/.emacs.d/elpa/chess-2.0.5/chess-perft hides /home/dick/.local/share/emacs/site-lisp/chess-perft
/home/dick/.emacs.d/elpa/chess-2.0.5/chess-glaurung hides /home/dick/.local/share/emacs/site-lisp/chess-glaurung
/home/dick/.emacs.d/elpa/chess-2.0.5/chess-ai hides /home/dick/.local/share/emacs/site-lisp/chess-ai
/home/dick/.emacs.d/elpa/chess-2.0.5/chess-fruit hides /home/dick/.local/share/emacs/site-lisp/chess-fruit
/home/dick/.emacs.d/elpa/chess-2.0.5/chess-uci hides /home/dick/.local/share/emacs/site-lisp/chess-uci
/home/dick/.emacs.d/elpa/chess-2.0.5/chess-epd hides /home/dick/.local/share/emacs/site-lisp/chess-epd
/home/dick/.emacs.d/elpa/chess-2.0.5/chess-database hides /home/dick/.local/share/emacs/site-lisp/chess-database
/home/dick/.emacs.d/elpa/chess-2.0.5/chess-link hides /home/dick/.local/share/emacs/site-lisp/chess-link
/home/dick/.emacs.d/elpa/chess-2.0.5/chess-transport hides /home/dick/.local/share/emacs/site-lisp/chess-transport
/home/dick/.emacs.d/elpa/chess-2.0.5/chess-none hides /home/dick/.local/share/emacs/site-lisp/chess-none
/home/dick/.emacs.d/elpa/chess-2.0.5/chess-polyglot hides /home/dick/.local/share/emacs/site-lisp/chess-polyglot
/home/dick/.emacs.d/elpa/chess-2.0.5/chess-crafty hides /home/dick/.local/share/emacs/site-lisp/chess-crafty
/home/dick/.emacs.d/elpa/chess-2.0.5/chess-chat hides /home/dick/.local/share/emacs/site-lisp/chess-chat
/home/dick/.emacs.d/elpa/chess-2.0.5/chess hides /home/dick/.local/share/emacs/site-lisp/chess
/home/dick/.emacs.d/elpa/chess-2.0.5/chess-images hides /home/dick/.local/share/emacs/site-lisp/chess-images
/home/dick/.emacs.d/elpa/chess-2.0.5/chess-gnuchess hides /home/dick/.local/share/emacs/site-lisp/chess-gnuchess
/home/dick/.emacs.d/elpa/chess-2.0.5/chess-fen hides /home/dick/.local/share/emacs/site-lisp/chess-fen
/home/dick/.emacs.d/elpa/chess-2.0.5/chess-ics hides /home/dick/.local/share/emacs/site-lisp/chess-ics
/home/dick/.emacs.d/elpa/chess-2.0.5/chess-ics2 hides /home/dick/.local/share/emacs/site-lisp/chess-ics2
/home/dick/.emacs.d/elpa/chess-2.0.5/chess-common hides /home/dick/.local/share/emacs/site-lisp/chess-common
/home/dick/.emacs.d/elpa/chess-2.0.5/chess-input hides /home/dick/.local/share/emacs/site-lisp/chess-input
/home/dick/.emacs.d/elpa/chess-2.0.5/chess-announce hides /home/dick/.local/share/emacs/site-lisp/chess-announce
/home/dick/.emacs.d/elpa/chess-2.0.5/chess-clock hides /home/dick/.local/share/emacs/site-lisp/chess-clock
/home/dick/.emacs.d/elpa/chess-2.0.5/chess-sound hides /home/dick/.local/share/emacs/site-lisp/chess-sound
/home/dick/.emacs.d/elpa/chess-2.0.5/chess-sjeng hides /home/dick/.local/share/emacs/site-lisp/chess-sjeng
/home/dick/.emacs.d/elpa/chess-2.0.5/chess-algebraic hides /home/dick/.local/share/emacs/site-lisp/chess-algebraic
/home/dick/.emacs.d/elpa/transient-0.3.7snapshot/transient hides /home/dick/.local/share/emacs/0.3.1/lisp/transient

Features:
(magit-extras tabify man mule-util jka-compr dumb-jump cc-mode cc-fonts
cc-guess cc-menus cc-cmds cc-styles cc-align cc-engine cc-vars cc-defs
pulse face-remap magit-patch-changelog magit-patch magit-bookmark
magit-submodule magit-obsolete magit-blame magit-stash magit-reflog
magit-bisect magit-push magit-pull magit-fetch magit-clone magit-remote
magit-commit magit-sequence magit-notes magit-worktree magit-tag
magit-merge magit-branch magit-reset magit-files magit-refs magit-status
magit magit-repos magit-apply magit-wip magit-log which-func imenu
edebug debug backtrace magit-diff git-commit log-edit pcvs-util add-log
magit-core magit-margin magit-transient magit-process with-editor server
magit-mode transient vc smerge-mode diff tramp-archive tramp-gvfs
tramp-cache time-stamp zeroconf bug-reference vc-git diff-mode
vc-dispatcher sh-script executable elpaso elpaso-admin elpaso-milky
elpaso-defs shortdoc consult compat-28 recentf tree-widget bookmark
help-fns radix-tree blamer a tramp tramp-loaddefs trampver
tramp-integration cus-start files-x tramp-compat shell pcomplete ls-lisp
smiley mm-archive gnus-async gnus-ml gnus-kill gnus-dup disp-table utf-7
gnus-notifications gnus-fun notifications url-cache misearch
multi-isearch benchmark shadow sort bbdb-message footnote mail-extr
emacsbug nnrss nnfolder nndiscourse rbenv nnhackernews nntwitter
nntwitter-api bbdb-gnus gnus-demon nntp nnmairix nnml nnreddit
gnus-topic url-http url-auth url-gw network-stream nsm request
virtualenvwrapper gud s json-rpc python gnus-score score-mode gnus-bcklg
gnus-srvr gnus-cite anaphora bbdb-mua bbdb-com bbdb bbdb-site timezone
gnus-delay gnus-draft gnus-cache gnus-agent gnus-msg gnus-art mm-uu
mml2015 mm-view mml-smime smime gnutls dig gnus-sum shr pixel-fill
kinsoku url-file svg dom nndraft nnmh gnus-group mm-url gnus-undo
use-package use-package-delight use-package-diminish gnus-start
gnus-dbus dbus xml gnus-cloud nnimap nnmail mail-source utf7 nnoo
parse-time iso8601 gnus-spec gnus-int gnus-range message sendmail
yank-media puny dired-x dired dired-loaddefs rfc822 mml mml-sec epa epg
rfc6068 epg-config mm-decode mm-bodies mm-encode mail-parse rfc2231
rfc2047 rfc2045 ietf-drums mailabbrev gmm-utils mailheader gnus-win
paredit-ext paredit inf-ruby ruby-mode smie company pcase
haskell-interactive-mode haskell-presentation-mode haskell-process
haskell-session haskell-compile haskell-mode haskell-cabal haskell-utils
haskell-font-lock haskell-indentation haskell-string
haskell-sort-imports haskell-lexeme haskell-align-imports
haskell-complete-module haskell-ghc-support noutline outline
flymake-proc flymake warnings etags fileloop generator dabbrev
haskell-customize hydra lv use-package-ensure solarized-theme
solarized-definitions projectile lisp-mnt ibuf-ext ibuffer
ibuffer-loaddefs thingatpt magit-autorevert autorevert filenotify
magit-git magit-base magit-section format-spec crm dash rx compat-27
compat-26 compat grep compile comint ansi-color gnus nnheader range
mail-utils mm-util mail-prsvr gnus-util text-property-search time-date
flx-ido flx google-translate-default-ui google-translate-core-ui
facemenu color ido google-translate-core google-translate-tk
google-translate-backend use-package-bind-key bind-key auto-complete
easy-mmode advice edmacro kmacro popup cus-edit pp cus-load icons
wid-edit emms-player-mplayer emms-player-simple emms emms-compat
cl-extra help-mode xref project use-package-core derived hl-line winner
ring consult-autoloads debbugs-autoloads eglot-autoloads
elpaso-disc-autoloads elpaso-autoloads find-func finder-inf
go-mode-autoloads json-reformat-autoloads json-snatcher-autoloads
magit-autoloads projectile-autoloads sml-mode-autoloads epl-autoloads
tornado-template-mode-autoloads typescript-mode-autoloads
request-autoloads info wordnut-autoloads package browse-url url
url-proxy url-privacy url-expand url-methods url-history url-cookie
generate-lisp-file url-domsuf url-util mailcap url-handlers url-parse
auth-source cl-seq eieio eieio-core cl-macs password-cache json subr-x
map byte-opt gv bytecomp byte-compile cconv cldefs url-vars cl-loaddefs
cl-lib rmc iso-transl tooltip eldoc paren electric uniquify ediff-hook
vc-hooks lisp-float-type elisp-mode mwheel term/x-win x-win
term/common-win x-dnd tool-bar dnd fontset image regexp-opt fringe
tree-sitter tabulated-list replace newcomment text-mode lisp-mode
prog-mode register page tab-bar menu-bar rfn-eshadow isearch easymenu
timer select scroll-bar mouse jit-lock font-lock syntax font-core
term/tty-colors frame minibuffer nadvice seq simple cl-generic
indonesian philippine cham georgian utf-8-lang misc-lang vietnamese
tibetan thai tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek
romanian slovak czech european ethiopic indian cyrillic chinese
composite emoji-zwj charscript charprop case-table epa-hook
jka-cmpr-hook help abbrev obarray oclosure cl-preloaded button loaddefs
faces cus-face macroexp files window text-properties overlay sha1 md5
base64 format env code-pages mule custom widget keymap
hashtable-print-readable backquote threads dbusbind inotify lcms2
dynamic-setting system-font-setting font-render-setting cairo
move-toolbar gtk x-toolkit xinput2 x multi-tty make-network-process
emacs)

Memory information:
((conses 16 1107080 43082)
 (symbols 48 47047 3)
 (strings 32 214940 28162)
 (string-bytes 1 6605441)
 (vectors 16 111778)
 (vector-slots 8 2954688 68976)
 (floats 8 1144 1007)
 (intervals 56 67190 890)
 (buffers 1000 47))

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

* bug#57081: 29.0.50; [PATCH] Point associated with Window for good reasons
  2022-08-09 12:01 bug#57081: 29.0.50; [PATCH] Point associated with Window for good reasons dick.r.chiang
@ 2022-08-09 16:53 ` Eli Zaretskii
  2022-08-09 17:35   ` dick
  2022-08-09 17:55 ` Lars Ingebrigtsen
  1 sibling, 1 reply; 18+ messages in thread
From: Eli Zaretskii @ 2022-08-09 16:53 UTC (permalink / raw)
  To: dick.r.chiang; +Cc: 57081

> From: dick.r.chiang@gmail.com
> Date: Tue, 09 Aug 2022 08:01:57 -0400
> 
> We regularly split the same buffer across two windows (C-x 2) and
> position one window as a reference while manipulating the other.
> 
> When temporarily switching out one window, say to check a definition,
> our flow gets wrecked by C-x b's refusal to flip back to the original
> buffer since it's already displayed in another window, albeit, and
> very importantly, at a different point (which to belabor things, is
> the whole reason we want the same buffer in two windows).

But if you then insist on switching to that same buffer (which "C-x b"
doesn't refuse, it just doesn't offer it as the default, but you can
bring it up by M-p/M-n in the minibuffer at the prompt), then you will
be shown that buffer at the point you last displayed in that window,
which is what you want.

So I'm not sure what you are trying to fix here, and your description
stops short of telling that.





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

* bug#57081: 29.0.50; [PATCH] Point associated with Window for good reasons
  2022-08-09 16:53 ` Eli Zaretskii
@ 2022-08-09 17:35   ` dick
  2022-08-09 17:41     ` Eli Zaretskii
  0 siblings, 1 reply; 18+ messages in thread
From: dick @ 2022-08-09 17:35 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 57081

I am reminded of the famous diner scene in Five Easy Pieces (1970).

The waitress didn't refuse the order outright; she did let Jack talk to
the manager.





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

* bug#57081: 29.0.50; [PATCH] Point associated with Window for good reasons
  2022-08-09 17:35   ` dick
@ 2022-08-09 17:41     ` Eli Zaretskii
  0 siblings, 0 replies; 18+ messages in thread
From: Eli Zaretskii @ 2022-08-09 17:41 UTC (permalink / raw)
  To: dick; +Cc: 57081

> From: dick <dick.r.chiang@gmail.com>
> Cc: 57081@debbugs.gnu.org
> Date: Tue, 09 Aug 2022 13:35:49 -0400
> 
> I am reminded of the famous diner scene in Five Easy Pieces (1970).
> 
> The waitress didn't refuse the order outright; she did let Jack talk to
> the manager.

Iuppiter iratus ergo nefas.





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

* bug#57081: 29.0.50; [PATCH] Point associated with Window for good reasons
  2022-08-09 12:01 bug#57081: 29.0.50; [PATCH] Point associated with Window for good reasons dick.r.chiang
  2022-08-09 16:53 ` Eli Zaretskii
@ 2022-08-09 17:55 ` Lars Ingebrigtsen
  2022-08-09 18:18   ` Eli Zaretskii
  1 sibling, 1 reply; 18+ messages in thread
From: Lars Ingebrigtsen @ 2022-08-09 17:55 UTC (permalink / raw)
  To: dick.r.chiang; +Cc: 57081

dick.r.chiang@gmail.com writes:

> When temporarily switching out one window, say to check a definition,
> our flow gets wrecked by C-x b's refusal to flip back to the original
> buffer since it's already displayed in another window, albeit, and
> very importantly, at a different point (which to belabor things, is
> the whole reason we want the same buffer in two windows).

I think adding this might make sense, but with a user option to control
the action.

> * lisp/ido.el (ido-make-buffer-list-1): De-obfuscate.
> (ido-make-buffer-list): Include visible buffer when switching.
> (ido-get-buffers-in-frames): De-obfuscate.
> * lisp/window.el (read-buffer-to-switch): Include visible buffer.
> * test/lisp/ido-tests.el (ert-deftest): Test it.

And as usual, your patch includes a whole bunch of apparently irrelevant
stuff.






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

* bug#57081: 29.0.50; [PATCH] Point associated with Window for good reasons
  2022-08-09 17:55 ` Lars Ingebrigtsen
@ 2022-08-09 18:18   ` Eli Zaretskii
  2022-08-09 18:25     ` Lars Ingebrigtsen
  0 siblings, 1 reply; 18+ messages in thread
From: Eli Zaretskii @ 2022-08-09 18:18 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: dick.r.chiang, 57081

> Cc: 57081@debbugs.gnu.org
> From: Lars Ingebrigtsen <larsi@gnus.org>
> Date: Tue, 09 Aug 2022 19:55:54 +0200
> 
> dick.r.chiang@gmail.com writes:
> 
> > When temporarily switching out one window, say to check a definition,
> > our flow gets wrecked by C-x b's refusal to flip back to the original
> > buffer since it's already displayed in another window, albeit, and
> > very importantly, at a different point (which to belabor things, is
> > the whole reason we want the same buffer in two windows).
> 
> I think adding this might make sense, but with a user option to control
> the action.

Which action is that?  As I explained already, if we want to be able
to display the same buffer at another position, that is already
supported in "emacs -Q".





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

* bug#57081: 29.0.50; [PATCH] Point associated with Window for good reasons
  2022-08-09 18:18   ` Eli Zaretskii
@ 2022-08-09 18:25     ` Lars Ingebrigtsen
  2022-08-09 18:35       ` Eli Zaretskii
  0 siblings, 1 reply; 18+ messages in thread
From: Lars Ingebrigtsen @ 2022-08-09 18:25 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: dick.r.chiang, 57081

Eli Zaretskii <eliz@gnu.org> writes:

> Which action is that?  As I explained already, if we want to be able
> to display the same buffer at another position, that is already
> supported in "emacs -Q".

I don't think there's any easy way to get the action Dick described --
`C-x 2', `C-x b RET', and then have `C-x b <something-easy>' bring back
the same buffer in that window?






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

* bug#57081: 29.0.50; [PATCH] Point associated with Window for good reasons
  2022-08-09 18:25     ` Lars Ingebrigtsen
@ 2022-08-09 18:35       ` Eli Zaretskii
  2022-08-09 18:39         ` Eli Zaretskii
  2022-08-09 19:08         ` Lars Ingebrigtsen
  0 siblings, 2 replies; 18+ messages in thread
From: Eli Zaretskii @ 2022-08-09 18:35 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: dick.r.chiang, 57081

> From: Lars Ingebrigtsen <larsi@gnus.org>
> Cc: dick.r.chiang@gmail.com,  57081@debbugs.gnu.org
> Date: Tue, 09 Aug 2022 20:25:30 +0200
> 
> Eli Zaretskii <eliz@gnu.org> writes:
> 
> > Which action is that?  As I explained already, if we want to be able
> > to display the same buffer at another position, that is already
> > supported in "emacs -Q".
> 
> I don't think there's any easy way to get the action Dick described --
> `C-x 2', `C-x b RET', and then have `C-x b <something-easy>' bring back
> the same buffer in that window?

Yes: <something-easy> is M-n, sometimes twice.

I do this all the time, because I frequently have the same buffer
displayed at different positions in two different windows.





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

* bug#57081: 29.0.50; [PATCH] Point associated with Window for good reasons
  2022-08-09 18:35       ` Eli Zaretskii
@ 2022-08-09 18:39         ` Eli Zaretskii
  2022-08-09 19:10           ` dick
  2022-08-09 19:08         ` Lars Ingebrigtsen
  1 sibling, 1 reply; 18+ messages in thread
From: Eli Zaretskii @ 2022-08-09 18:39 UTC (permalink / raw)
  To: larsi; +Cc: dick.r.chiang, 57081

> Cc: dick.r.chiang@gmail.com, 57081@debbugs.gnu.org
> Date: Tue, 09 Aug 2022 21:35:51 +0300
> From: Eli Zaretskii <eliz@gnu.org>
> 
> > From: Lars Ingebrigtsen <larsi@gnus.org>
> > Cc: dick.r.chiang@gmail.com,  57081@debbugs.gnu.org
> > Date: Tue, 09 Aug 2022 20:25:30 +0200
> > 
> > I don't think there's any easy way to get the action Dick described --
> > `C-x 2', `C-x b RET', and then have `C-x b <something-easy>' bring back
> > the same buffer in that window?
> 
> Yes: <something-easy> is M-n, sometimes twice.

And after you do this once, M-p will also do.





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

* bug#57081: 29.0.50; [PATCH] Point associated with Window for good reasons
  2022-08-09 18:35       ` Eli Zaretskii
  2022-08-09 18:39         ` Eli Zaretskii
@ 2022-08-09 19:08         ` Lars Ingebrigtsen
  2022-08-09 19:22           ` Eli Zaretskii
  1 sibling, 1 reply; 18+ messages in thread
From: Lars Ingebrigtsen @ 2022-08-09 19:08 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: dick.r.chiang, 57081

Eli Zaretskii <eliz@gnu.org> writes:

>> I don't think there's any easy way to get the action Dick described --
>> `C-x 2', `C-x b RET', and then have `C-x b <something-easy>' bring back
>> the same buffer in that window?
>
> Yes: <something-easy> is M-n, sometimes twice.

That's only the case if you've previously switched to a buffer in a way
that makes that buffer be in the history variable -- but there's a
number of ways to switch to a buffer without that happening.  Like `C-x
C-b' and then selecting a buffer there.





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

* bug#57081: 29.0.50; [PATCH] Point associated with Window for good reasons
  2022-08-09 18:39         ` Eli Zaretskii
@ 2022-08-09 19:10           ` dick
  0 siblings, 0 replies; 18+ messages in thread
From: dick @ 2022-08-09 19:10 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 57081

EZ> And after you do this once, M-p will also do.

Yes, GNU Emacs users should do that.  Commercial Emacs users will use
"C-x b RET".  Closing.





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

* bug#57081: 29.0.50; [PATCH] Point associated with Window for good reasons
  2022-08-09 19:08         ` Lars Ingebrigtsen
@ 2022-08-09 19:22           ` Eli Zaretskii
  2022-08-09 19:29             ` Lars Ingebrigtsen
  0 siblings, 1 reply; 18+ messages in thread
From: Eli Zaretskii @ 2022-08-09 19:22 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: dick.r.chiang, 57081

> From: Lars Ingebrigtsen <larsi@gnus.org>
> Cc: dick.r.chiang@gmail.com,  57081@debbugs.gnu.org
> Date: Tue, 09 Aug 2022 21:08:43 +0200
> 
> Eli Zaretskii <eliz@gnu.org> writes:
> 
> >> I don't think there's any easy way to get the action Dick described --
> >> `C-x 2', `C-x b RET', and then have `C-x b <something-easy>' bring back
> >> the same buffer in that window?
> >
> > Yes: <something-easy> is M-n, sometimes twice.
> 
> That's only the case if you've previously switched to a buffer in a way
> that makes that buffer be in the history variable

No, that's M-p.  M-n is "future history", it's invented by Emacs.





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

* bug#57081: 29.0.50; [PATCH] Point associated with Window for good reasons
  2022-08-09 19:22           ` Eli Zaretskii
@ 2022-08-09 19:29             ` Lars Ingebrigtsen
  2022-08-09 19:35               ` Eli Zaretskii
  0 siblings, 1 reply; 18+ messages in thread
From: Lars Ingebrigtsen @ 2022-08-09 19:29 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: dick.r.chiang, 57081

Eli Zaretskii <eliz@gnu.org> writes:

> No, that's M-p.  M-n is "future history", it's invented by Emacs.

If I select a buffer via `C-x C-b', `C-x 2', `C-x b RET', `C-x b M-n'
just says "End of history" -- in ido.  But in "emacs -Q", hitting `M-n'
twice does get me to the same buffer, like you say.

So I guess this should just be fixed in ido somehow?





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

* bug#57081: 29.0.50; [PATCH] Point associated with Window for good reasons
  2022-08-09 19:29             ` Lars Ingebrigtsen
@ 2022-08-09 19:35               ` Eli Zaretskii
  2022-08-12 13:06                 ` Lars Ingebrigtsen
  0 siblings, 1 reply; 18+ messages in thread
From: Eli Zaretskii @ 2022-08-09 19:35 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: dick.r.chiang, 57081

> From: Lars Ingebrigtsen <larsi@gnus.org>
> Cc: dick.r.chiang@gmail.com,  57081@debbugs.gnu.org
> Date: Tue, 09 Aug 2022 21:29:02 +0200
> 
> Eli Zaretskii <eliz@gnu.org> writes:
> 
> > No, that's M-p.  M-n is "future history", it's invented by Emacs.
> 
> If I select a buffer via `C-x C-b', `C-x 2', `C-x b RET', `C-x b M-n'
> just says "End of history" -- in ido.  But in "emacs -Q", hitting `M-n'
> twice does get me to the same buffer, like you say.
> 
> So I guess this should just be fixed in ido somehow?

Yes, I think so.  Maybe they override M-n?  (I don't use ido.)





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

* bug#57081: 29.0.50; [PATCH] Point associated with Window for good reasons
  2022-08-09 19:35               ` Eli Zaretskii
@ 2022-08-12 13:06                 ` Lars Ingebrigtsen
  2022-08-12 13:19                   ` Eli Zaretskii
  2022-08-12 13:41                   ` dick
  0 siblings, 2 replies; 18+ messages in thread
From: Lars Ingebrigtsen @ 2022-08-12 13:06 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: dick.r.chiang, 57081

Eli Zaretskii <eliz@gnu.org> writes:

>> > No, that's M-p.  M-n is "future history", it's invented by Emacs.
>> 
>> If I select a buffer via `C-x C-b', `C-x 2', `C-x b RET', `C-x b M-n'
>> just says "End of history" -- in ido.  But in "emacs -Q", hitting `M-n'
>> twice does get me to the same buffer, like you say.
>> 
>> So I guess this should just be fixed in ido somehow?
>
> Yes, I think so.  Maybe they override M-n?  (I don't use ido.)

`M-n' doesn't quite fit in with how ido works -- its thing is that it
always shows you a number of candidates you choose between using the
arrow keys.

Hm...  oh!  Playing with this a bit more, it seems like ido is doing
something similar as `M-n'.  If you hit

C-x b
<right>
<right>

you get the buffer name that was shown in the window earlier -- I
haven't noticed that before.

So there does indeed not seem to be anything to fix here.





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

* bug#57081: 29.0.50; [PATCH] Point associated with Window for good reasons
  2022-08-12 13:06                 ` Lars Ingebrigtsen
@ 2022-08-12 13:19                   ` Eli Zaretskii
  2022-08-12 13:41                   ` dick
  1 sibling, 0 replies; 18+ messages in thread
From: Eli Zaretskii @ 2022-08-12 13:19 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: dick.r.chiang, 57081

> From: Lars Ingebrigtsen <larsi@gnus.org>
> Cc: dick.r.chiang@gmail.com,  57081@debbugs.gnu.org
> Date: Fri, 12 Aug 2022 15:06:53 +0200
> 
> Hm...  oh!  Playing with this a bit more, it seems like ido is doing
> something similar as `M-n'.  If you hit
> 
> C-x b
> <right>
> <right>
> 
> you get the buffer name that was shown in the window earlier -- I
> haven't noticed that before.

So ido places "future history" on the <RIGHT> arrow key, it seems.





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

* bug#57081: 29.0.50; [PATCH] Point associated with Window for good reasons
  2022-08-12 13:06                 ` Lars Ingebrigtsen
  2022-08-12 13:19                   ` Eli Zaretskii
@ 2022-08-12 13:41                   ` dick
  2022-08-12 13:57                     ` Lars Ingebrigtsen
  1 sibling, 1 reply; 18+ messages in thread
From: dick @ 2022-08-12 13:41 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: Eli Zaretskii, 57081

> So there does indeed not seem to be anything to fix here.

As usual, you people miss the point.

At least we are equally fervent about "being right."





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

* bug#57081: 29.0.50; [PATCH] Point associated with Window for good reasons
  2022-08-12 13:41                   ` dick
@ 2022-08-12 13:57                     ` Lars Ingebrigtsen
  0 siblings, 0 replies; 18+ messages in thread
From: Lars Ingebrigtsen @ 2022-08-12 13:57 UTC (permalink / raw)
  To: dick; +Cc: Eli Zaretskii, 57081

dick <dick.r.chiang@gmail.com> writes:

>> So there does indeed not seem to be anything to fix here.
>
> As usual, you people miss the point.

Is there any chance that you'll ever explain what your point is, then?







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

end of thread, other threads:[~2022-08-12 13:57 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-09 12:01 bug#57081: 29.0.50; [PATCH] Point associated with Window for good reasons dick.r.chiang
2022-08-09 16:53 ` Eli Zaretskii
2022-08-09 17:35   ` dick
2022-08-09 17:41     ` Eli Zaretskii
2022-08-09 17:55 ` Lars Ingebrigtsen
2022-08-09 18:18   ` Eli Zaretskii
2022-08-09 18:25     ` Lars Ingebrigtsen
2022-08-09 18:35       ` Eli Zaretskii
2022-08-09 18:39         ` Eli Zaretskii
2022-08-09 19:10           ` dick
2022-08-09 19:08         ` Lars Ingebrigtsen
2022-08-09 19:22           ` Eli Zaretskii
2022-08-09 19:29             ` Lars Ingebrigtsen
2022-08-09 19:35               ` Eli Zaretskii
2022-08-12 13:06                 ` Lars Ingebrigtsen
2022-08-12 13:19                   ` Eli Zaretskii
2022-08-12 13:41                   ` dick
2022-08-12 13:57                     ` Lars Ingebrigtsen

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).