* Passing arguments to Elisp function
@ 2020-11-01 16:54 jai-bholeki via Users list for the GNU Emacs text editor
2020-11-01 17:44 ` Jean Louis
2020-11-01 20:59 ` tomas
0 siblings, 2 replies; 4+ messages in thread
From: jai-bholeki via Users list for the GNU Emacs text editor @ 2020-11-01 16:54 UTC (permalink / raw)
To: help-gnu-emacs@gnu.org
I have a function gets the beginning and end of a region.
Is is possible to pass another argument to the function that is a character 'ch'?
(defun pengo (beg end)
(interactive "r") ; Specifies Mark and Point, smallest first
(goto-char beg)
)
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Passing arguments to Elisp function
2020-11-01 16:54 Passing arguments to Elisp function jai-bholeki via Users list for the GNU Emacs text editor
@ 2020-11-01 17:44 ` Jean Louis
2020-11-01 20:59 ` tomas
1 sibling, 0 replies; 4+ messages in thread
From: Jean Louis @ 2020-11-01 17:44 UTC (permalink / raw)
To: jai-bholeki; +Cc: help-gnu-emacs@gnu.org
* jai-bholeki via Users list for the GNU Emacs text editor <help-gnu-emacs@gnu.org> [2020-11-01 19:56]:
> I have a function gets the beginning and end of a region.
>
> Is is possible to pass another argument to the function that is a character 'ch'?
>
> (defun pengo (beg end)
> (interactive "r") ; Specifies Mark and Point, smallest first
> (goto-char beg)
> )
Make the function ask user for additional character before goto-char
probably.
(read-char-from-minibuffer "Char: ")
If you need more than char read-from-minibuffer
You may explore which read functions exist by:
C-h f read-TAB and you may see various, not all are useful for that
case. You get information about the function with C-h f
--
There are 50 messages yet in my incoming mailbox.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Passing arguments to Elisp function
2020-11-01 16:54 Passing arguments to Elisp function jai-bholeki via Users list for the GNU Emacs text editor
2020-11-01 17:44 ` Jean Louis
@ 2020-11-01 20:59 ` tomas
2020-11-01 21:03 ` jai-bholeki
1 sibling, 1 reply; 4+ messages in thread
From: tomas @ 2020-11-01 20:59 UTC (permalink / raw)
To: jai-bholeki; +Cc: help-gnu-emacs@gnu.org
[-- Attachment #1: Type: text/plain, Size: 639 bytes --]
On Sun, Nov 01, 2020 at 04:54:55PM +0000, jai-bholeki via Users list for the GNU Emacs text editor wrote:
> I have a function gets the beginning and end of a region.
>
> Is is possible to pass another argument to the function that is a character 'ch'?
>
> (defun pengo (beg end)
> (interactive "r") ; Specifies Mark and Point, smallest first
> (goto-char beg)
> )
You mean something like this?
(defun foo (beg end ch)
(interactive "rRegion:\ncChar:")
(message "Region: (%d, %d) Char: %c" beg end ch))
(i.e. separate consecutive args in the interactive specification with
a new line, `\n').
Cheers
- t
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Passing arguments to Elisp function
2020-11-01 20:59 ` tomas
@ 2020-11-01 21:03 ` jai-bholeki
0 siblings, 0 replies; 4+ messages in thread
From: jai-bholeki @ 2020-11-01 21:03 UTC (permalink / raw)
To: tomas@tuxteam.de; +Cc: help-gnu-emacs@gnu.org
Correct. Got it
Cheers.
‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
On Sunday, 1 November 2020 21:59, <tomas@tuxteam.de> wrote:
> On Sun, Nov 01, 2020 at 04:54:55PM +0000, jai-bholeki via Users list for the GNU Emacs text editor wrote:
>
> > I have a function gets the beginning and end of a region.
> > Is is possible to pass another argument to the function that is a character 'ch'?
> > (defun pengo (beg end)
> > (interactive "r") ; Specifies Mark and Point, smallest first
> > (goto-char beg)
> > )
>
> You mean something like this?
>
> (defun foo (beg end ch)
> (interactive "rRegion:\ncChar:")
> (message "Region: (%d, %d) Char: %c" beg end ch))
>
> (i.e. separate consecutive args in the interactive specification with
> a new line, `\n').
>
> Cheers
>
> - t
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-11-01 21:03 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-11-01 16:54 Passing arguments to Elisp function jai-bholeki via Users list for the GNU Emacs text editor
2020-11-01 17:44 ` Jean Louis
2020-11-01 20:59 ` tomas
2020-11-01 21:03 ` jai-bholeki
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).