all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Joost Kremers <joostkremers@fastmail.fm>
To: emacs-devel@gnu.org
Cc: martin rudalics <rudalics@gmx.at>, Eli Zaretskii <eliz@gnu.org>
Subject: Re: Adding olivetti to GNU ELPA
Date: Tue, 14 May 2019 23:56:24 +0200	[thread overview]
Message-ID: <87a7fohf93.fsf@fastmail.fm> (raw)
In-Reply-To: <jwvsgth56i9.fsf-monnier+emacs@gnu.org>


On Tue, May 14 2019, Stefan Monnier wrote:
>> (defun visual-fill-column-mode--enable ()
>>  "Set up `visual-fill-column-mode' for the current buffer."
>>  (add-hook 'window-configuration-change-hook
>> #'visual-fill-column--adjust-window 'append 'local)
>>  (if (>= emacs-major-version 26)
>>      (add-hook 'window-size-change-functions
>> #'visual-fill-column--adjust-frame 'append))
>>  (visual-fill-column--adjust-window))
>
> If you fundamentally only care about the size of the windows,

Yes, specifically their width.

> then in
> Emacs-27 all you need is
>
>       (add-hook 'window-size-change-functions
>                 #'visual-fill-column--adjust-window 'append 
>                 'local)
>
>> frame. In Emacs 27, this function must be in the global part of
>> `window-size-change-functions`,
>
> Not really: in Emacs-26, if it's on the local-part of the hook, 
> then it
> will fail to be called when your window's size is changed as
> a side-effect of some other window being resized (this is fixed 
> in
> Emacs-27).  In Emacs-27, on the contrary it can be in the local 
> part of
> the hook and can limit its action to the window passed as an 
> argument
> rather than having to cycle through all windows on the selected 
> frame,
> because the local part of the hook is run (separately) for every 
> window
> whose size has changed.

Ah, I see.

The problem I ran into (and with prompted my remark above) was 
that in Emacs 26, the functions in window-size-change-functions 
are called with the frame as argument, even the functions in the 
local part of the hook. In Emacs 27, the functions in the global 
part are called with the frame as argument, while the functions in 
the local part are called with the window as argument. Since the 
function that `visual-fill-column-mode` puts in the hook assumes 
the frame as argument, the simplest change seemed to be to put it 
in the global part. It seems that wasn't the only solution, and 
arguably it's not the best solution either...

I'll set up a VirtualBox so I can test it with Emacs 27 and make 
the change when I have some time.

Thanks for the info. 

-- 
Joost Kremers
Life has its moments



  reply	other threads:[~2019-05-14 21:56 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-25  8:32 Adding olivetti to GNU ELPA Paul W. Rankin
2019-04-25  8:56 ` Eli Zaretskii
2019-04-25 12:32   ` Paul W. Rankin
2019-04-25 12:43     ` Eli Zaretskii
2019-04-25 13:01       ` Paul W. Rankin
2019-04-25 14:30         ` Eli Zaretskii
2019-05-08  4:07           ` Paul W. Rankin
2019-05-08  6:20             ` Eli Zaretskii
2019-05-09  6:54               ` Paul W. Rankin
2019-05-09  7:53                 ` Eli Zaretskii
2019-05-09  8:14                 ` martin rudalics
2019-05-09 13:30                   ` Stefan Monnier
2019-05-10  8:00                     ` martin rudalics
2019-05-14  5:16                   ` Paul W. Rankin
2019-05-14  7:04                     ` Paul W. Rankin
2019-05-14 12:22                     ` Stefan Monnier
2019-05-15  8:26                       ` Paul W. Rankin
2019-05-14 16:05                     ` Joost Kremers
2019-05-14 16:50                       ` Stefan Monnier
2019-05-14 21:56                         ` Joost Kremers [this message]
2019-05-15  1:29                           ` Stefan Monnier
2019-05-20  8:24                     ` martin rudalics
2019-05-20 13:14                       ` Paul W. Rankin
2019-05-21  7:32                         ` martin rudalics
2019-05-21  7:38                           ` Paul W. Rankin
2019-05-21  7:45                             ` martin rudalics
2019-05-21  9:05                               ` Paul W. Rankin
2019-05-21 10:04                                 ` martin rudalics
2019-05-22  1:47                                   ` Paul W. Rankin
2019-05-22  8:32                                     ` martin rudalics
2019-05-22  9:14                                       ` Paul W. Rankin
2019-05-08 14:07             ` Stefan Monnier
2019-05-08 15:45             ` Stephen Leake
2019-05-08 17:50               ` Eli Zaretskii
2019-04-26  1:17   ` Richard Stallman

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

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

  git send-email \
    --in-reply-to=87a7fohf93.fsf@fastmail.fm \
    --to=joostkremers@fastmail.fm \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@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 external index

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

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