all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Re: /srv/bzr/emacs/trunk r109577: * lisp/subr.el (internal--before-with-seleted-window)
@ 2012-08-13 10:48 Dmitry Gutov
  2012-08-13 11:10 ` chad
  2012-08-13 14:13 ` Stefan Monnier
  0 siblings, 2 replies; 4+ messages in thread
From: Dmitry Gutov @ 2012-08-13 10:48 UTC (permalink / raw)
  To: monnier; +Cc: emacs-devel

Hi Stefan,

I think you have a typo there in function names: seleted -> selected.

Stefan Monnier <monnier@iro.umontreal.ca> writes:
 > ------------------------------------------------------------
 > revno: 109577
 > committer: Stefan Monnier <monnier@iro.umontreal.ca>
 > branch nick: trunk
 > timestamp: Sun 2012-08-12 18:52:33 -0400
 > message:
 >   * lisp/subr.el (internal--before-with-seleted-window)
 >   (internal--after-with-seleted-window): New functions.
 >   (with-selected-window): Use them, to replace dependency on 
tty-top-frame.
 > modified:
 >   lisp/ChangeLog
 >   lisp/subr.el
 > === modified file 'lisp/ChangeLog'
 > --- a/lisp/ChangeLog	2012-08-12 22:06:56 +0000
 > +++ b/lisp/ChangeLog	2012-08-12 22:52:33 +0000
 > @@ -1,3 +1,9 @@
 > +2012-08-12  Stefan Monnier  <monnier@iro.umontreal.ca>
 > +
 > +	* subr.el (internal--before-with-seleted-window)
 > +	(internal--after-with-seleted-window): New functions.
 > +	(with-selected-window): Use them, to replace dependency on 
tty-top-frame.
 > +
 >  2012-08-12  Nobuyoshi Nakada  <nobu@ruby-lang.org>
 >
 >  	* progmodes/ruby-mode.el (ruby-mode-map): Remove unnecessary
 >
 > === modified file 'lisp/subr.el'
 > --- a/lisp/subr.el	2012-08-10 14:47:12 +0000
 > +++ b/lisp/subr.el	2012-08-12 22:52:33 +0000
 > @@ -3023,6 +3023,30 @@
 >       (set-buffer ,buffer-or-name)
 >       ,@body))
 >
 > +(defun internal--before-with-seleted-window (window)
 > +  (let ((other-frame (window-frame window)))
 > +    (list window (selected-window)
 > +          ;; Selecting a window on another frame also changes that
 > +          ;; frame's frame-selected-window.  We must save&restore it.
 > +          (unless (eq (selected-frame) other-frame)
 > +            (frame-selected-window other-frame))
 > +          ;; Also remember the top-frame if on ttys.
 > +          (unless (eq (selected-frame) other-frame)
 > +            (tty-top-frame other-frame)))))
 > +
 > +(defun internal--after-with-seleted-window (state)
 > +  ;; First reset frame-selected-window.
 > +  (when (window-live-p (nth 2 state))
 > +    ;; We don't use set-frame-selected-window because it does not
 > +    ;; pass the `norecord' argument to Fselect_window.
 > +    (select-window (nth 2 state) 'norecord)
 > +    (and (frame-live-p (nth 3 state))
 > +         (not (eq (tty-top-frame) (nth 3 state)))
 > +         (select-frame (nth 3 state) 'norecord)))
 > +  ;; Then reset the actual selected-window.
 > +  (when (window-live-p (nth 2 state))
 > +    (select-window (nth 2 state) 'norecord)))
 > +
 >  (defmacro with-selected-window (window &rest body)
 >    "Execute the forms in BODY with WINDOW as the selected window.
 >  The value returned is the value of the last form in BODY.
 > @@ -3040,34 +3064,13 @@
 >  potentially make a different buffer current.  It does not alter
 >  the buffer list ordering."
 >    (declare (indent 1) (debug t))
 > -  ;; Most of this code is a copy of save-selected-window.
 > -  `(let* ((save-selected-window-destination ,window)
 > -	  (save-selected-window-frame
 > -	   (window-frame save-selected-window-destination))
 > -          (save-selected-window-window (selected-window))
 > -          ;; Selecting a window on another frame also changes that
 > -          ;; frame's frame-selected-window.  We must save&restore it.
 > -          (save-selected-window-other-frame
 > -           (unless (eq (selected-frame) save-selected-window-frame)
 > -             (frame-selected-window save-selected-window-frame)))
 > -	  (save-selected-window-top-frame
 > -           (unless (eq (selected-frame) save-selected-window-frame)
 > -	     (tty-top-frame save-selected-window-frame))))
 > +  `(let ((save-selected-window--state
 > +          (internal--before-with-seleted-window ,window)))
 >       (save-current-buffer
 >         (unwind-protect
 > -           (progn (select-window save-selected-window-destination 
'norecord)
 > +           (progn (select-window (car save-selected-window--state) 
'norecord)
 >  		  ,@body)
 > -         ;; First reset frame-selected-window.
 > -         (when (window-live-p save-selected-window-other-frame)
 > -	   ;; We don't use set-frame-selected-window because it does not
 > -	   ;; pass the `norecord' argument to Fselect_window.
 > -	   (select-window save-selected-window-other-frame 'norecord)
 > -	   (and (frame-live-p save-selected-window-top-frame)
 > -		(not (eq (tty-top-frame) save-selected-window-top-frame))
 > -		(select-frame save-selected-window-top-frame 'norecord)))
 > -         ;; Then reset the actual selected-window.
 > -	 (when (window-live-p save-selected-window-window)
 > -	   (select-window save-selected-window-window 'norecord))))))
 > +         (internal--before-with-seleted-window 
save-selected-window--state)))))
 >
 >  (defmacro with-selected-frame (frame &rest body)
 >    "Execute the forms in BODY with FRAME as the selected frame.



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

* Re: /srv/bzr/emacs/trunk r109577: * lisp/subr.el (internal--before-with-seleted-window)
  2012-08-13 10:48 /srv/bzr/emacs/trunk r109577: * lisp/subr.el (internal--before-with-seleted-window) Dmitry Gutov
@ 2012-08-13 11:10 ` chad
  2012-08-13 11:14   ` Dmitry Gutov
  2012-08-13 14:13 ` Stefan Monnier
  1 sibling, 1 reply; 4+ messages in thread
From: chad @ 2012-08-13 11:10 UTC (permalink / raw)
  To: Dmitry Gutov; +Cc: monnier, emacs-devel


On 13 Aug 2012, at 03:48, Dmitry Gutov <dgutov@yandex.ru> wrote:

> Hi Stefan,
> 
> I think you have a typo there in function names: seleted -> selected.

This is the problem I reported a couple hours back; Martin Rudalics pushed a fix already (thanks, Martin!)

*Chad




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

* Re: /srv/bzr/emacs/trunk r109577: * lisp/subr.el (internal--before-with-seleted-window)
  2012-08-13 11:10 ` chad
@ 2012-08-13 11:14   ` Dmitry Gutov
  0 siblings, 0 replies; 4+ messages in thread
From: Dmitry Gutov @ 2012-08-13 11:14 UTC (permalink / raw)
  To: chad; +Cc: monnier, emacs-devel

On 13.08.2012 15:10, chad wrote:
>
> On 13 Aug 2012, at 03:48, Dmitry Gutov <dgutov@yandex.ru> wrote:
>
>> Hi Stefan,
>>
>> I think you have a typo there in function names: seleted -> selected.
>
> This is the problem I reported a couple hours back; Martin Rudalics pushed a fix already (thanks, Martin!)

Nope, that's a different one.




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

* Re: /srv/bzr/emacs/trunk r109577: * lisp/subr.el (internal--before-with-seleted-window)
  2012-08-13 10:48 /srv/bzr/emacs/trunk r109577: * lisp/subr.el (internal--before-with-seleted-window) Dmitry Gutov
  2012-08-13 11:10 ` chad
@ 2012-08-13 14:13 ` Stefan Monnier
  1 sibling, 0 replies; 4+ messages in thread
From: Stefan Monnier @ 2012-08-13 14:13 UTC (permalink / raw)
  To: Dmitry Gutov; +Cc: emacs-devel

> I think you have a typo there in function names: seleted -> selected.

Duh, thanks, fixed,


        Stefan


> Stefan Monnier <monnier@iro.umontreal.ca> writes:
>> ------------------------------------------------------------
>> revno: 109577
>> committer: Stefan Monnier <monnier@iro.umontreal.ca>
>> branch nick: trunk
>> timestamp: Sun 2012-08-12 18:52:33 -0400
>> message:
>> * lisp/subr.el (internal--before-with-seleted-window)
>> (internal--after-with-seleted-window): New functions.
>> (with-selected-window): Use them, to replace dependency on 
> tty-top-frame.
>> modified:
>> lisp/ChangeLog
>> lisp/subr.el
>> === modified file 'lisp/ChangeLog'
>> --- a/lisp/ChangeLog	2012-08-12 22:06:56 +0000
>> +++ b/lisp/ChangeLog	2012-08-12 22:52:33 +0000
>> @@ -1,3 +1,9 @@
>> +2012-08-12  Stefan Monnier  <monnier@iro.umontreal.ca>
>> +
>> +	* subr.el (internal--before-with-seleted-window)
>> +	(internal--after-with-seleted-window): New functions.
>> +	(with-selected-window): Use them, to replace dependency on 
> tty-top-frame.
>> +
>> 2012-08-12  Nobuyoshi Nakada  <nobu@ruby-lang.org>
>> 
>> * progmodes/ruby-mode.el (ruby-mode-map): Remove unnecessary
>> 
>> === modified file 'lisp/subr.el'
>> --- a/lisp/subr.el	2012-08-10 14:47:12 +0000
>> +++ b/lisp/subr.el	2012-08-12 22:52:33 +0000
>> @@ -3023,6 +3023,30 @@
>> (set-buffer ,buffer-or-name)
>> ,@body))
>> 
>> +(defun internal--before-with-seleted-window (window)
>> +  (let ((other-frame (window-frame window)))
>> +    (list window (selected-window)
>> +          ;; Selecting a window on another frame also changes that
>> +          ;; frame's frame-selected-window.  We must save&restore it.
>> +          (unless (eq (selected-frame) other-frame)
>> +            (frame-selected-window other-frame))
>> +          ;; Also remember the top-frame if on ttys.
>> +          (unless (eq (selected-frame) other-frame)
>> +            (tty-top-frame other-frame)))))
>> +
>> +(defun internal--after-with-seleted-window (state)
>> +  ;; First reset frame-selected-window.
>> +  (when (window-live-p (nth 2 state))
>> +    ;; We don't use set-frame-selected-window because it does not
>> +    ;; pass the `norecord' argument to Fselect_window.
>> +    (select-window (nth 2 state) 'norecord)
>> +    (and (frame-live-p (nth 3 state))
>> +         (not (eq (tty-top-frame) (nth 3 state)))
>> +         (select-frame (nth 3 state) 'norecord)))
>> +  ;; Then reset the actual selected-window.
>> +  (when (window-live-p (nth 2 state))
>> +    (select-window (nth 2 state) 'norecord)))
>> +
>> (defmacro with-selected-window (window &rest body)
>> "Execute the forms in BODY with WINDOW as the selected window.
>> The value returned is the value of the last form in BODY.
>> @@ -3040,34 +3064,13 @@
>> potentially make a different buffer current.  It does not alter
>> the buffer list ordering."
>> (declare (indent 1) (debug t))
>> -  ;; Most of this code is a copy of save-selected-window.
>> -  `(let* ((save-selected-window-destination ,window)
>> -	  (save-selected-window-frame
>> -	   (window-frame save-selected-window-destination))
>> -          (save-selected-window-window (selected-window))
>> -          ;; Selecting a window on another frame also changes that
>> -          ;; frame's frame-selected-window.  We must save&restore it.
>> -          (save-selected-window-other-frame
>> -           (unless (eq (selected-frame) save-selected-window-frame)
>> -             (frame-selected-window save-selected-window-frame)))
>> -	  (save-selected-window-top-frame
>> -           (unless (eq (selected-frame) save-selected-window-frame)
>> -	     (tty-top-frame save-selected-window-frame))))
>> +  `(let ((save-selected-window--state
>> +          (internal--before-with-seleted-window ,window)))
>> (save-current-buffer
>> (unwind-protect
>> -           (progn (select-window save-selected-window-destination 
> 'norecord)
>> +           (progn (select-window (car save-selected-window--state) 
> 'norecord)
>> ,@body)
>> -         ;; First reset frame-selected-window.
>> -         (when (window-live-p save-selected-window-other-frame)
>> -	   ;; We don't use set-frame-selected-window because it does not
>> -	   ;; pass the `norecord' argument to Fselect_window.
>> -	   (select-window save-selected-window-other-frame 'norecord)
>> -	   (and (frame-live-p save-selected-window-top-frame)
>> -		(not (eq (tty-top-frame) save-selected-window-top-frame))
>> -		(select-frame save-selected-window-top-frame 'norecord)))
>> -         ;; Then reset the actual selected-window.
>> -	 (when (window-live-p save-selected-window-window)
>> -	   (select-window save-selected-window-window 'norecord))))))
>> +         (internal--before-with-seleted-window 
> save-selected-window--state)))))
>> 
>> (defmacro with-selected-frame (frame &rest body)
>> "Execute the forms in BODY with FRAME as the selected frame.



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

end of thread, other threads:[~2012-08-13 14:13 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-08-13 10:48 /srv/bzr/emacs/trunk r109577: * lisp/subr.el (internal--before-with-seleted-window) Dmitry Gutov
2012-08-13 11:10 ` chad
2012-08-13 11:14   ` Dmitry Gutov
2012-08-13 14:13 ` Stefan Monnier

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.