unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Christopher Dimech <dimech@gmx.com>
To: Christopher Dimech <dimech@gmx.com>
Cc: Help Gnu Emacs <help-gnu-emacs@gnu.org>
Subject: Re: RE: Checking if frame has only one visible buffer
Date: Sun, 22 Nov 2020 01:16:03 +0100	[thread overview]
Message-ID: <trinity-038d6130-e31a-4288-9a8c-1b8186562e8d-1606004163293@3c-app-mailcom-bs11> (raw)
In-Reply-To: <trinity-141e6832-5986-4a15-b2b7-e0f652dbc16a-1606000024519@3c-app-mailcom-bs11>

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'.
> >
>
>



      reply	other threads:[~2020-11-22  0:16 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]

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=trinity-038d6130-e31a-4288-9a8c-1b8186562e8d-1606004163293@3c-app-mailcom-bs11 \
    --to=dimech@gmx.com \
    --cc=help-gnu-emacs@gnu.org \
    /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.
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).