unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Juri Linkov <juri@linkov.net>
To: martin rudalics <rudalics@gmx.at>
Cc: 32790@debbugs.gnu.org
Subject: bug#32790: 27.0.50; point jumps unexpectedly after delete-window
Date: Tue, 13 Nov 2018 01:24:53 +0200	[thread overview]
Message-ID: <87tvklx4je.fsf@mail.linkov.net> (raw)
In-Reply-To: <5BE7EDAD.9040808@gmx.at> (martin rudalics's message of "Sun, 11 Nov 2018 09:51:57 +0100")

>> This summarizes the prefix keys where 'default' is the default
>> window selection behavior, and 'window-noselect' restores a previously
>> selected window:
>>
>>                                      default     window-noselect
>> relative to the position of point   no prefix   M-0
>> relative to the first edge          M-1         C-u
>> relative to the last edge           M-- 1       M--
>
> I would drop that edge thingy, interactively.  I'm quite convinced
> that nobody would ever use it.
>
> IMHO this "relative" code is there for historical reasons - the author
> wrote the simpler edges versions first, wrote the point version later
> and didn't want to drop the edges versions then (maybe also because he
> wasn't sure whether the point version would always work).  What I
> doubt is that a user would ever make the relativity choice
> interactively.  Rather people would be used to one or the other.

I agree, it's too complicated, I never used edges in windmove-do-window-select.

>> But maybe also another choice 'window-select' should be added to
>> force window selection?  I mean that some commands don't select
>> the displayed window by default, e.g. help commands like
>> 'C-h e', 'C-h f', 'C-h v', 'C-h k' after their invocation
>> don't select the window with the *Help* buffer.
>
> With 'help-window-select' non-nil they should always select the help
> window.

This means that every package should provide own customization
for the select/no-select choice for its windows, instead of
a general solution like inhibit-window-select that I tried to do.

>> Or maybe a prefix key should invert the default behavior,
>> e.g. 'S-M-right C-x v =' by default selects the displayed window,
>> so ‘C-u S-M-right C-x v =’ will not select the window.
>> 'S-M-right C-h e' by default doesn't select the window,
>> so ‘C-u S-M-right C-h e’ will select the window.
>
> That would confuse the hell out of me.  I'm not sure how you or others
> feel, but personally I would prefer a fixed two layer choice like:
>
> (1) The select/no-select choice always bound to one and the same
> prefix key _regardless_ of the default behavior of the function (for
> the buffer at hand), and

This is implemented in a new version:

(defun windmove-display-in-direction (dir &optional arg)
  "Display the next buffer in the window at direction DIR.
Create a new window if there is no window in that direction.
Without a prefix arg, select the window with a displayed buffer.
If prefix ARG is `C-u', reselect a previously selected window."
  (interactive)
  (let* ((no-select (consp arg))
         (old-window (or (minibuffer-selected-window) (selected-window)))
         (new-window)
         (minibuffer-depth (minibuffer-depth))
         (action display-buffer-overriding-action)
         (command this-command)
         (clearfun (make-symbol "clear-display-buffer-overriding-action"))
         (exitfun
          (lambda ()
            (setq display-buffer-overriding-action action)
            (when (window-live-p (if no-select old-window new-window))
              (select-window (if no-select old-window new-window)))
            (remove-hook 'post-command-hook clearfun))))
    (fset clearfun
          (lambda ()
            (unless (or
		     ;; Remove the hook immediately
		     ;; after exiting the minibuffer.
		     (> (minibuffer-depth) minibuffer-depth)
		     ;; But don't remove immediately after
		     ;; adding the hook by the same command below.
		     (eq this-command command))
              (funcall exitfun))))
    (add-hook 'post-command-hook clearfun)
    (push (lambda (buffer alist)
	    (unless (> (minibuffer-depth) minibuffer-depth)
	      (let ((window (if (eq dir 'same-window)
			        (selected-window)
                              (window-in-direction
                               dir nil nil
                               (and arg (prefix-numeric-value arg))
                               windmove-wrap-around)))
                    (type 'reuse))
                (unless window
                  (setq window (split-window nil nil dir) type 'window))
		(setq new-window (window--display-buffer buffer window type alist)))))
          display-buffer-overriding-action)
    (message "[display-%s]" dir)))

> (2) in addition to a window relative to the selected window (above, on
> the right, ... a new one always made by splitting the selected window)
> optionally allow a window relative to the selected frame (on the top
> full-width, on the right full-height, ... a new one always made by
> splitting the frame's root window) bound to another prefix key.
>
> Then (2) could be generalized via a global option to use/make a new
> (child) frame in the indicated direction or whatever people want.

But does windmove support frames in the first place?
Can you use e.g. S-left to select a frame on the left?
Does window-in-direction currently return frames?





  reply	other threads:[~2018-11-12 23:24 UTC|newest]

Thread overview: 127+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-20 23:33 bug#32790: 27.0.50; point jumps unexpectedly after delete-window Juri Linkov
2018-09-21  6:34 ` martin rudalics
2018-09-22 22:23   ` Juri Linkov
2018-09-23  5:44     ` Eli Zaretskii
2018-09-23  8:27     ` martin rudalics
2018-09-23 20:57       ` Juri Linkov
2018-09-24  8:33         ` martin rudalics
2018-09-24 18:49           ` Juri Linkov
2018-09-25  7:28             ` martin rudalics
2018-09-25 19:28               ` Juri Linkov
2018-09-26  8:51                 ` martin rudalics
2018-09-26 23:05                   ` Juri Linkov
2018-09-27 18:44                     ` martin rudalics
2018-10-15 21:12                       ` Juri Linkov
2018-10-16  8:46                         ` martin rudalics
2018-10-16 22:20                           ` Juri Linkov
2018-10-17  7:30                             ` martin rudalics
2018-10-17 21:30                               ` Juri Linkov
2018-10-18  8:05                                 ` martin rudalics
2018-10-18 22:49                                   ` Juri Linkov
2018-10-19  7:39                                     ` martin rudalics
2018-10-20 21:27                                       ` Juri Linkov
2018-10-21  8:22                                         ` martin rudalics
2018-10-21 18:17                                           ` Juri Linkov
2018-10-22  9:07                                             ` martin rudalics
2018-10-23 20:55                                               ` Juri Linkov
2018-10-24  9:45                                                 ` martin rudalics
2018-10-25 20:48                                                   ` Juri Linkov
2018-10-26  7:41                                                     ` martin rudalics
2018-10-27 19:51                                                       ` Juri Linkov
2018-10-28  8:59                                                         ` martin rudalics
2018-10-28 19:36                                                           ` Juri Linkov
2018-10-29  8:44                                                             ` martin rudalics
2018-10-29 13:45                                                             ` martin rudalics
2018-10-29 22:38                                                               ` Juri Linkov
2018-10-30  9:00                                                                 ` martin rudalics
2018-10-30 21:42                                                                   ` Juri Linkov
2018-10-31  8:11                                                                     ` martin rudalics
2018-10-31 21:20                                                                       ` Juri Linkov
2018-11-01  9:03                                                                         ` martin rudalics
2018-11-01 22:42                                                                           ` Juri Linkov
2018-11-02  8:44                                                                             ` martin rudalics
2018-11-02 14:36                                                                               ` Drew Adams
2018-11-04 22:01                                                                               ` Juri Linkov
2018-11-05  9:35                                                                                 ` martin rudalics
2018-11-04 22:21                                                                               ` Juri Linkov
2018-11-05  9:36                                                                                 ` martin rudalics
2018-11-05 22:14                                                                                   ` Juri Linkov
2018-11-06  8:48                                                                                     ` martin rudalics
2018-11-06 22:22                                                                                       ` Juri Linkov
2018-11-07  9:23                                                                                         ` martin rudalics
2018-11-07 21:44                                                                                           ` Juri Linkov
2018-11-08  8:52                                                                                             ` martin rudalics
2018-11-08 21:38                                                                                               ` Juri Linkov
2018-11-09  9:08                                                                                                 ` martin rudalics
2018-11-10 21:25                                                                                                   ` Juri Linkov
2018-12-26  2:04                                                                                                 ` Dmitry Gutov
2018-11-08 21:53                                                                                           ` Juri Linkov
2018-11-09  9:13                                                                                             ` martin rudalics
2018-11-10 21:37                                                                                               ` Juri Linkov
2018-11-11  8:51                                                                                                 ` martin rudalics
2018-11-12 23:24                                                                                                   ` Juri Linkov [this message]
2018-11-13  9:08                                                                                                     ` martin rudalics
2018-11-13 23:20                                                                                                       ` Juri Linkov
2018-11-14  8:33                                                                                                         ` martin rudalics
2018-11-15  0:15                                                                                                           ` Juri Linkov
2018-11-15  9:13                                                                                                             ` martin rudalics
2018-11-15 22:59                                                                                                               ` Juri Linkov
2018-11-16  8:53                                                                                                                 ` martin rudalics
2018-11-17 22:18                                                                                                                   ` Juri Linkov
2018-11-18  9:24                                                                                                                     ` martin rudalics
2018-11-18 22:52                                                                                                                       ` Juri Linkov
2018-11-19  9:42                                                                                                                         ` martin rudalics
2018-11-19 22:39                                                                                                                           ` Juri Linkov
2018-11-20  9:28                                                                                                                             ` martin rudalics
2018-11-21  0:12                                                                                                                               ` Juri Linkov
2018-11-21  8:19                                                                                                                                 ` martin rudalics
2018-11-21 23:38                                                                                                                                   ` Juri Linkov
2018-11-22  7:40                                                                                                                                     ` martin rudalics
2018-11-22 22:45                                                                                                                                       ` Juri Linkov
2018-11-23  7:39                                                                                                                                         ` martin rudalics
2018-11-24 23:40                                                                                                                                           ` Juri Linkov
2018-11-25  8:23                                                                                                                                             ` martin rudalics
2018-11-25 21:01                                                                                                                                               ` Juri Linkov
2018-11-26  9:33                                                                                                                                                 ` martin rudalics
2018-11-26 23:47                                                                                                                                                   ` Juri Linkov
2018-11-27  6:00                                                                                                                                                     ` Eli Zaretskii
2018-11-27 23:18                                                                                                                                                       ` Juri Linkov
2018-11-28  8:33                                                                                                                                                         ` martin rudalics
2018-11-28 23:25                                                                                                                                                           ` Juri Linkov
2018-11-29  8:30                                                                                                                                                             ` martin rudalics
2018-11-29 22:50                                                                                                                                                               ` Juri Linkov
2018-11-30  8:22                                                                                                                                                                 ` martin rudalics
2018-12-01 22:43                                                                                                                                                                   ` Juri Linkov
2018-12-02  8:34                                                                                                                                                                     ` martin rudalics
2018-12-03  0:45                                                                                                                                                                       ` Juri Linkov
2018-12-03  7:45                                                                                                                                                                         ` martin rudalics
2018-12-20 23:28                                                                                                                                                                           ` Juri Linkov
2018-12-21  9:14                                                                                                                                                                             ` martin rudalics
2018-12-22 23:34                                                                                                                                                                               ` Juri Linkov
2018-12-23  9:40                                                                                                                                                                                 ` martin rudalics
2018-11-27  8:08                                                                                                                                                     ` martin rudalics
2018-11-04 22:07                               ` Juri Linkov
2018-11-05  9:35                                 ` martin rudalics
2018-11-05 22:12                                   ` Juri Linkov
2018-11-06  8:47                                     ` martin rudalics
2018-11-21 23:35   ` Juri Linkov
2018-11-22  7:40     ` martin rudalics
2018-11-22 22:39       ` Juri Linkov
2018-11-23  7:40         ` martin rudalics
2018-11-24 23:20           ` Juri Linkov
2018-11-25  8:24             ` martin rudalics
2018-11-26 23:53       ` Juri Linkov
2018-11-27  8:08         ` martin rudalics
2018-11-27 23:28           ` Juri Linkov
2018-11-28  8:33             ` martin rudalics
2018-09-21  6:55 ` Eli Zaretskii
2018-09-22 22:34   ` Juri Linkov
2018-09-23  8:28     ` martin rudalics
2018-09-23 10:56     ` Eli Zaretskii
2018-09-23 20:49       ` Juri Linkov
2018-09-24  8:23         ` martin rudalics
2018-09-24  8:30           ` Eli Zaretskii
2018-09-24 12:25             ` martin rudalics
2018-09-24 18:53           ` Juri Linkov
2018-09-25  7:28             ` martin rudalics
2019-11-24 23:19 ` Juri Linkov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87tvklx4je.fsf@mail.linkov.net \
    --to=juri@linkov.net \
    --cc=32790@debbugs.gnu.org \
    --cc=rudalics@gmx.at \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).