bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#33871: 27.0.50; Revert Dired window saved in window configuration


From: martin rudalics
Subject: bug#33871: 27.0.50; Revert Dired window saved in window configuration
Date: Mon, 19 Feb 2024 10:42:46 +0100
User-agent: Mozilla Thunderbird

> Ok, let's add the WINDOW argument.  This means that most hooks
> will need to call 'with-selected-window' explicitly.  But maybe
> there will be hooks that don't need to select a window.

(setq-default window-set-context-function
              (lambda (w)
                (let ((point (window-point w)))
                  (with-current-buffer (window-buffer w)
                    `((front-context-string
                       . ,(buffer-substring-no-properties
                           point (min (+ point 16) (point-max))))
                      (rear-context-string
                       . ,(buffer-substring-no-properties
                           point (max (- point 16) (point-min)))))))))

should suffice to make 'buffer-substring-no-properties' work.  Note that
if you select the window beforehand, 'selected-window' will not return a
meaningful value in the body of the function called.  This is a problem
of many "hooks" like 'mode-line-format' or 'window-configuration-hook'.
The comfort you get comes at the price of a lack of generality.

martin





reply via email to

[Prev in Thread] Current Thread [Next in Thread]