all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Checking if frame has only one visible buffer
@ 2020-11-21 22:13 Christopher Dimech
  2020-11-21 22:29 ` Drew Adams
  0 siblings, 1 reply; 5+ messages in thread
From: Christopher Dimech @ 2020-11-21 22:13 UTC (permalink / raw)
  To: Help Gnu Emacs

Am writing some elisp code and want to check if there is just one visible buffer in frame.




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

* RE: Checking if frame has only one visible buffer
  2020-11-21 22:13 Checking if frame has only one visible buffer Christopher Dimech
@ 2020-11-21 22:29 ` Drew Adams
  2020-11-21 22:36   ` Christopher Dimech
  2020-11-21 23:07   ` Christopher Dimech
  0 siblings, 2 replies; 5+ messages in thread
From: Drew Adams @ 2020-11-21 22:29 UTC (permalink / raw)
  To: Christopher Dimech, Help Gnu Emacs

> Am writing some elisp code and want to check if there is just one
> visible buffer in frame.

Does `one-window-p' do what you want?
___

For discovery purposes (and other understanding),
it helps to assimilate the Emacs jargon.  A buffer
need not be displayed.  If displayed, it's shown
in a window.  And a window is in a frame.

If you know you're looking for a function that
involves windows, then `M-x apropos window' will
help.  If you're thinking of a buffer then it
won't help you find `one-window-p'.



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

* Re: RE: Checking if frame has only one visible buffer
  2020-11-21 22:29 ` Drew Adams
@ 2020-11-21 22:36   ` Christopher Dimech
  2020-11-21 23:07   ` Christopher Dimech
  1 sibling, 0 replies; 5+ messages in thread
From: Christopher Dimech @ 2020-11-21 22:36 UTC (permalink / raw)
  To: Drew Adams; +Cc: Help Gnu Emacs


> Sent: Saturday, November 21, 2020 at 11:29 PM
> From: "Drew Adams" <drew.adams@oracle.com>
> To: "Christopher Dimech" <dimech@gmx.com>, "Help Gnu Emacs" <help-gnu-emacs@gnu.org>
> Subject: RE: Checking if frame has only one visible buffer
>
> > Am writing some elisp code and want to check if there is just one
> > visible buffer in frame.
>
> Does `one-window-p' do what you want?
> ___
>
> For discovery purposes (and other understanding),
> it helps to assimilate the Emacs jargon.  A buffer
> need not be displayed.  If displayed, it's shown
> in a window.  And a window is in a frame.

Correct.  Wanted to see if the frame contains just one window
and not multiple windows.

> If you know you're looking for a function that
> involves windows, then `M-x apropos window' will
> help.  If you're thinking of a buffer then it
> won't help you find `one-window-p'.
>
>



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

* Re: RE: Checking if frame has only one visible buffer
  2020-11-21 22:29 ` Drew Adams
  2020-11-21 22:36   ` Christopher Dimech
@ 2020-11-21 23:07   ` Christopher Dimech
  2020-11-22  0:16     ` Christopher Dimech
  1 sibling, 1 reply; 5+ messages in thread
From: Christopher Dimech @ 2020-11-21 23:07 UTC (permalink / raw)
  To: Drew Adams; +Cc: Help Gnu Emacs


> Sent: Saturday, November 21, 2020 at 11:29 PM
> From: "Drew Adams" <drew.adams@oracle.com>
> To: "Christopher Dimech" <dimech@gmx.com>, "Help Gnu Emacs" <help-gnu-emacs@gnu.org>
> Subject: RE: Checking if frame has only one visible buffer
>
> > Am writing some elisp code and want to check if there is just one
> > visible buffer in frame.
>
> Does `one-window-p' do what you want?

It does.  How can I improve on the code below?

(defun fullscr-cycle ()
   "Toggles Fullscreen Mode for a Gungadin Buffer"
   (interactive)
   (if (eq (frame-parameter nil 'fullscreen) 'fullboth)
       (progn
          (if (one-window-p)
            (progn (gungadin-buffer 0)
                   (disable-fullscr))
            (disable-fullscr)))
      (progn
         (if (one-window-p)
            (progn (gungadin-buffer)
                   (enable-fullscr))
            (enable-fullscr))) ) )





> ___
>
> For discovery purposes (and other understanding),
> it helps to assimilate the Emacs jargon.  A buffer
> need not be displayed.  If displayed, it's shown
> in a window.  And a window is in a frame.
>
> If you know you're looking for a function that
> involves windows, then `M-x apropos window' will
> help.  If you're thinking of a buffer then it
> won't help you find `one-window-p'.
>



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

* Re: RE: Checking if frame has only one visible buffer
  2020-11-21 23:07   ` Christopher Dimech
@ 2020-11-22  0:16     ` Christopher Dimech
  0 siblings, 0 replies; 5+ messages in thread
From: Christopher Dimech @ 2020-11-22  0:16 UTC (permalink / raw)
  To: Christopher Dimech; +Cc: Help Gnu Emacs

I have now removed the progn and have got to the below.
Any more simplifications and improvements?


(defun fullscr-cycle ()
   "Toggles Fullscreen Mode for a Gungadin Buffer"
   (interactive)
   (if (eq (frame-parameter nil 'fullscreen) 'fullboth)
      (if (one-window-p)
         (progn (gungadin-buffer 0)
                (disable-fullscr))
         (disable-fullscr))
      (if (one-window-p)
         (progn (gungadin-buffer)
                (enable-fullscr))
         (enable-fullscr)) ))



> Sent: Sunday, November 22, 2020 at 12:07 AM
> From: "Christopher Dimech" <dimech@gmx.com>
> To: "Drew Adams" <drew.adams@oracle.com>
> Cc: "Help Gnu Emacs" <help-gnu-emacs@gnu.org>
> Subject: Re: RE: Checking if frame has only one visible buffer
>
>
> > Sent: Saturday, November 21, 2020 at 11:29 PM
> > From: "Drew Adams" <drew.adams@oracle.com>
> > To: "Christopher Dimech" <dimech@gmx.com>, "Help Gnu Emacs" <help-gnu-emacs@gnu.org>
> > Subject: RE: Checking if frame has only one visible buffer
> >
> > > Am writing some elisp code and want to check if there is just one
> > > visible buffer in frame.
> >
> > Does `one-window-p' do what you want?
>
> It does.  How can I improve on the code below?
>
>.(defun fullscr-cycle ()
>...."Toggles Fullscreen Mode for a Gungadin Buffer"
>....(interactive)
>....(if (eq (frame-parameter nil 'fullscreen) 'fullboth)
>.......(progn
>..........(if (one-window-p)
>.............(progn (margined-window 0)
>....................(disable-fullscr))
>.............(disable-fullscr)))
>.......(progn
>..........(if (one-window-p)
>.............(progn (margined-window) ; Defaults to 3
>....................(enable-fullscr))
>.............(enable-fullscr))) ) )
>
>
>
>
>
> > ___
> >
> > For discovery purposes (and other understanding),
> > it helps to assimilate the Emacs jargon.  A buffer
> > need not be displayed.  If displayed, it's shown
> > in a window.  And a window is in a frame.
> >
> > If you know you're looking for a function that
> > involves windows, then `M-x apropos window' will
> > help.  If you're thinking of a buffer then it
> > won't help you find `one-window-p'.
> >
>
>



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

end of thread, other threads:[~2020-11-22  0:16 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-11-21 22:13 Checking if frame has only one visible buffer Christopher Dimech
2020-11-21 22:29 ` Drew Adams
2020-11-21 22:36   ` Christopher Dimech
2020-11-21 23:07   ` Christopher Dimech
2020-11-22  0:16     ` Christopher Dimech

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.