unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* define a keybinding for "find next alternate definition of last tag specified"
@ 2013-02-27 12:36 Burkhard Schultheis
  2013-02-27 13:53 ` Burkhard Schultheis
  0 siblings, 1 reply; 6+ messages in thread
From: Burkhard Schultheis @ 2013-02-27 12:36 UTC (permalink / raw)
  To: help-gnu-emacs

I want to have a single keystroke for the keystroke sequence C-u m-. 
(find next alternate definition of last tag specified). as far as I see 
there is no command associated with this action.

How can I define a global key in my .emacs file for this action?

Thank you in advance!

Regards
Burkhard


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

* Re: define a keybinding for "find next alternate definition of last tag specified"
  2013-02-27 12:36 define a keybinding for "find next alternate definition of last tag specified" Burkhard Schultheis
@ 2013-02-27 13:53 ` Burkhard Schultheis
  2013-02-27 19:23   ` define a keybinding for "find next alternate definition of lasttag specified" Drew Adams
                     ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Burkhard Schultheis @ 2013-02-27 13:53 UTC (permalink / raw)
  To: help-gnu-emacs

Am 27.02.2013 13:36, schrieb Burkhard Schultheis:
> I want to have a single keystroke for the keystroke sequence C-u m-.
> (find next alternate definition of last tag specified). as far as I see
> there is no command associated with this action.
>
> How can I define a global key in my .emacs file for this action?
>
> Thank you in advance!
>

In the meantime I've tried it several ways, last test was:

(defun find-next-tag ()
   "Find next tag with TAGS file"
   ((kdb <C-u>) (kbd <M-.>)))

(global-set-key [M-f9] 'find-next-tag)

If a try Alt-F9 I get an error message reading "Wrong type argument: 
commandp, find-next-tag"

I've tried it with the function names, too, but I got every time the 
same error message.

What's wrong and how to do it right?

Regards
Burkhard



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

* RE: define a keybinding for "find next alternate definition of lasttag specified"
  2013-02-27 13:53 ` Burkhard Schultheis
@ 2013-02-27 19:23   ` Drew Adams
  2013-02-27 19:53   ` define a keybinding for "find next alternate definition of last tag specified" Jambunathan K
                     ` (2 subsequent siblings)
  3 siblings, 0 replies; 6+ messages in thread
From: Drew Adams @ 2013-02-27 19:23 UTC (permalink / raw)
  To: 'Burkhard Schultheis', help-gnu-emacs

> (defun find-next-tag ()
>    "Find next tag with TAGS file"
>    ((kdb <C-u>) (kbd <M-.>)))
> 
> (global-set-key [M-f9] 'find-next-tag)
> 
> If a try Alt-F9 I get an error message reading "Wrong type argument: 
> commandp, find-next-tag"
> 
> I've tried it with the function names, too, but I got every time the 
> same error message.  What's wrong and how to do it right?

First, the error msg means that your function needs to have an `interactive'
spec.  That's what makes an EmacsLisp function be a command.  See node `Using
Interactive' of the Elisp manual.

Second, the function body is no good.  This is what I would do:

(defun find-next-tag ()
  "..."
  (interactive)
  (find-tag t))

The non-nil argument tells `find-tag' that you want the next definition.

You can find this out by doing `C-h k M-.'.  That tells you that the function
you need to call is `find-tag', and it tells you that a non-nil first argument
NEXT-P corresponds to providing a prefix argument interactively.




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

* Re: define a keybinding for "find next alternate definition of last tag specified"
  2013-02-27 13:53 ` Burkhard Schultheis
  2013-02-27 19:23   ` define a keybinding for "find next alternate definition of lasttag specified" Drew Adams
@ 2013-02-27 19:53   ` Jambunathan K
       [not found]   ` <mailman.21045.1361993039.855.help-gnu-emacs@gnu.org>
  2013-02-28 15:00   ` define a keybinding for "find next alternate definition of last tag specified" Kevin Rodgers
  3 siblings, 0 replies; 6+ messages in thread
From: Jambunathan K @ 2013-02-27 19:53 UTC (permalink / raw)
  To: Burkhard Schultheis; +Cc: help-gnu-emacs


You can let Emacs define stuff for you.

    (fset 'find-alt-tag
       (lambda (&optional arg) "Keyboard macro." (interactive "p") 
         (kmacro-exec-ring-item (quote ("\256" 0 "%d")) arg)))

    (global-set-key [27 f9] (quote find-alt-tag))

Esc-F9 will find the alternate tag.

I have used kbd macros 
  C-x (  do something C-x )
  C-x C-k n
  M-x insert-kbd-macro 

followed by

    M-x global-set-key RET
    M-x list-command-history RET

For background reading do this.  Note the capital "K"

    C-h K C-x (
    C-h K C-x C-k n

ps: Gnus will truncate a C-u in the find-alt-tag definition above.  But
you have the recipe now, so...


Burkhard Schultheis <burkhard.schultheis@web.de> writes:

> Am 27.02.2013 13:36, schrieb Burkhard Schultheis:
>> I want to have a single keystroke for the keystroke sequence C-u m-.
>> (find next alternate definition of last tag specified). as far as I see
>> there is no command associated with this action.
>>
>> How can I define a global key in my .emacs file for this action?
>>
>> Thank you in advance!
>>
>
> In the meantime I've tried it several ways, last test was:
>
> (defun find-next-tag ()
>   "Find next tag with TAGS file"
>   ((kdb <C-u>) (kbd <M-.>)))
>
> (global-set-key [M-f9] 'find-next-tag)
>
> If a try Alt-F9 I get an error message reading "Wrong type argument:
> commandp, find-next-tag"
>
> I've tried it with the function names, too, but I got every time the
> same error message.
>
> What's wrong and how to do it right?
>
> Regards
> Burkhard
>
>

-- 



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

* Re: define a keybinding for "find next alternate definition of lasttag specified"
       [not found]   ` <mailman.21045.1361993039.855.help-gnu-emacs@gnu.org>
@ 2013-02-28  8:31     ` Burkhard Schultheis
  0 siblings, 0 replies; 6+ messages in thread
From: Burkhard Schultheis @ 2013-02-28  8:31 UTC (permalink / raw)
  To: help-gnu-emacs

Am 27.02.2013 20:23, schrieb Drew Adams:
>
> Second, the function body is no good.  This is what I would do:
>
> (defun find-next-tag ()
>    "..."
>    (interactive)
>    (find-tag t))
>

I've tried now

(defun find-next-tag ()
     "..."
     (interactive)
     (find-tag 0 t))

and this works as desired!

Thank you and Jambunathan, too!

Regards
Burkhard


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

* Re: define a keybinding for "find next alternate definition of last tag specified"
  2013-02-27 13:53 ` Burkhard Schultheis
                     ` (2 preceding siblings ...)
       [not found]   ` <mailman.21045.1361993039.855.help-gnu-emacs@gnu.org>
@ 2013-02-28 15:00   ` Kevin Rodgers
  3 siblings, 0 replies; 6+ messages in thread
From: Kevin Rodgers @ 2013-02-28 15:00 UTC (permalink / raw)
  To: help-gnu-emacs

On 2/27/13 6:53 AM, Burkhard Schultheis wrote:
> Am 27.02.2013 13:36, schrieb Burkhard Schultheis:
>> I want to have a single keystroke for the keystroke sequence C-u m-.
>> (find next alternate definition of last tag specified). as far as I see
>> there is no command associated with this action.
>>
>> How can I define a global key in my .emacs file for this action?
>>
>> Thank you in advance!
>>
>
> In the meantime I've tried it several ways, last test was:
>
> (defun find-next-tag ()
> "Find next tag with TAGS file"
> ((kdb <C-u>) (kbd <M-.>)))

It looks like you're intending to set the function binding to a key
sequence, which effectively defines find-next-tag as keyboard macro.

But it needs to be a proper string or vector of keyboard events, not a
lambda form (which is what defun installs) so you need to use fset:

(fset 'find-next-tag "\C-u\M-.")

(fset 'find-next-tag [?\C-u ?\M-.])

> (global-set-key [M-f9] 'find-next-tag)
>
> If a try Alt-F9 I get an error message reading "Wrong type argument: commandp,
> find-next-tag"
>
> I've tried it with the function names, too, but I got every time the same error
> message.
>
> What's wrong and how to do it right?
>
> Regards
> Burkhard
>
>


-- 
Kevin Rodgers
Denver, Colorado, USA




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

end of thread, other threads:[~2013-02-28 15:00 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-02-27 12:36 define a keybinding for "find next alternate definition of last tag specified" Burkhard Schultheis
2013-02-27 13:53 ` Burkhard Schultheis
2013-02-27 19:23   ` define a keybinding for "find next alternate definition of lasttag specified" Drew Adams
2013-02-27 19:53   ` define a keybinding for "find next alternate definition of last tag specified" Jambunathan K
     [not found]   ` <mailman.21045.1361993039.855.help-gnu-emacs@gnu.org>
2013-02-28  8:31     ` define a keybinding for "find next alternate definition of lasttag specified" Burkhard Schultheis
2013-02-28 15:00   ` define a keybinding for "find next alternate definition of last tag specified" Kevin Rodgers

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