unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Heime <heimeborgia@protonmail.com>
To: Drew Adams <drew.adams@oracle.com>
Cc: Heime via Users list for the GNU Emacs text editor
	<help-gnu-emacs@gnu.org>
Subject: RE: [External] : Interactive option for command application
Date: Tue, 25 Jun 2024 10:11:05 +0000	[thread overview]
Message-ID: <RZd5AB2n9rbh-fkx4u0lj9X4l0cQDEZY1j_bhBfm2hcg3kkJGTHscBxPF6p3Bttr9yxebxNtUjo6R4vbudPqraruTc1JOpKN9k_4yVDTkQ8=@protonmail.com> (raw)
In-Reply-To: <SJ0PR10MB5488299B1FEF494F18015AF4F3D52@SJ0PR10MB5488.namprd10.prod.outlook.com>


On Tuesday, June 25th, 2024 at 12:22 AM, Drew Adams <drew.adams@oracle.com> wrote:

> > > > > Have a prefix arg use the frame. No prefix arg means use the buffer.
> > > > 
> > > > How would I handle the prefix arg to do as you suggest ?
> > > 
> > > Consult the manual - look for `interactive'. Look for` current-prefix-
> > > arg' if you use a Lisp sexp as arg to `interactive'.
> > 
> > Would I have to figure out whether I have '(4) or not, or just an if upon
> > current-prefix-arg ?
> 
> 
> Consult the doc. There are even examples there, IIRC.
> 
> `interactive' just passes some args to the body of your command code. 
> It's the logic of that body code that decides what to do with those args.

I have done like this, with a boolean monfont-prefix, I can change whether
I use the prefix or not.  When using the prefix, I set the "Frame" option,
otherwise I use the "Buffer" option.

If not using the prefix argument (monfont-prefix is nil) I ask the user
via completing-read. 

Would this be correct usage with current-prefix-arg ?

(defvar monfont-prefix t

  "Boolean variable determining if monfont uses the prefix argument.")


(defun monfont (face-family face-height okvir)

  (interactive

    (list

      (let ( (cseq '("Wargames" "URW Chancery L" "Century Schoolbook L")) )

        (completing-read " Family Name: " cseq nil t "Bold Oblique"))

      (let ( (hseq '("340" "300" "260" "230" "180")) )

        (completing-read " Face Height: " hseq nil nil "230"))

      (if monfont-prefix

          (if current-prefix-arg "Frame" "Buffer")

        (let ( (hseq '("Frame" "Buffer")) )

          (completing-read " Operation: " hseq nil t "Buffer"))) ))




      reply	other threads:[~2024-06-25 10:11 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-24 20:52 Interactive option for command application Heime
2024-06-24 21:36 ` [External] : " Drew Adams
2024-06-24 21:51   ` Heime
2024-06-24 23:53     ` Drew Adams
2024-06-25  0:11       ` Heime
2024-06-25  0:22         ` Drew Adams
2024-06-25 10:11           ` Heime [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='RZd5AB2n9rbh-fkx4u0lj9X4l0cQDEZY1j_bhBfm2hcg3kkJGTHscBxPF6p3Bttr9yxebxNtUjo6R4vbudPqraruTc1JOpKN9k_4yVDTkQ8=@protonmail.com' \
    --to=heimeborgia@protonmail.com \
    --cc=drew.adams@oracle.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).