all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* help create function alias
@ 2010-09-20 10:43 Adam
  2010-09-20 10:57 ` Marc Mientki
  2010-09-20 15:35 ` Stefan Monnier
  0 siblings, 2 replies; 15+ messages in thread
From: Adam @ 2010-09-20 10:43 UTC (permalink / raw)
  To: help-gnu-emacs

I use (insert-date) often, but rather than a hotkey I'd 
prefer M-x id  or  ALT-x id   

So in .emacs  I included the following, which I thought 
I had seen running earlier, but may indeed be problematic. 

Basically its an (id) alias of the (insert-date) function. 
Can anyone help or suggest where I've gone wrong ? 

(defun id () 
   "insert date" 
   (interactive "P") 
   (insert-date t))




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

* Re: help create function alias
  2010-09-20 10:43 help create function alias Adam
@ 2010-09-20 10:57 ` Marc Mientki
  2010-09-20 11:46   ` Adam
  2010-09-20 15:35 ` Stefan Monnier
  1 sibling, 1 reply; 15+ messages in thread
From: Marc Mientki @ 2010-09-20 10:57 UTC (permalink / raw)
  To: help-gnu-emacs

Am 20.09.2010 12:43, schrieb Adam:
> (defun id ()
>     "insert date"
>     (interactive "P")
>     (insert-date t))
>

There two errors:

1. You say (interactive "P") but not provide argument to id.
When you use "P", then you must write:
(defun if (arg) ...

or

(defun if (&optional arg) ...

But actualy you don't need "P" in your example. So you can write:

(defun id ()
    "insert date"
    (interactive)
    (insert-date t))

2. Function insert-date is not defined, at least not in my emacs.

HTH
Marc



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

* Re: help create function alias
  2010-09-20 10:57 ` Marc Mientki
@ 2010-09-20 11:46   ` Adam
       [not found]     ` <i77ma9$h97$1@lust.ihug.co.nz>
  0 siblings, 1 reply; 15+ messages in thread
From: Adam @ 2010-09-20 11:46 UTC (permalink / raw)
  To: help-gnu-emacs

Marc Mientki wrote:

> Am 20.09.2010 12:43, schrieb Adam:
>> (defun id ()
>>     "insert date"
>>     (interactive "P")
>>     (insert-date t))
>>
> 
> There two errors:
> 
> 1. You say (interactive "P") but not provide argument to id.
> When you use "P", then you must write:
> (defun if (arg) ...
> 
> or
> 
> (defun if (&optional arg) ...
> 
> But actualy you don't need "P" in your example. So you can write:
> 
> (defun id ()
>     "insert date"
>     (interactive)
>     (insert-date t))
> 
> 2. Function insert-date is not defined, at least not in my emacs.
> 
> HTH
> Marc

Thanks. It does help. 

In my .emacs I walked right past an (insert-date) function which 
I picked up from somewhere. It uses an ISO date format, includes 
the "P" for alternate formatting from the argument. 

Thanks.  










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

* Re: help create function alias
       [not found]     ` <i77ma9$h97$1@lust.ihug.co.nz>
@ 2010-09-20 14:11       ` Pascal J. Bourguignon
  2010-09-20 19:54         ` Adam
  0 siblings, 1 reply; 15+ messages in thread
From: Pascal J. Bourguignon @ 2010-09-20 14:11 UTC (permalink / raw)
  To: help-gnu-emacs

Adam <nospam@example.com> writes:

>> Marc Mientki wrote:
> [ ... ]
>
> Here's the (insert-date) function.  Which I now find doesn't 
> work when called from the changed (id) example below. 
>
> M-x id  returns "Wrong type argument: stringp, nil" 
> Strange, as I never used M-x insert-date  with any prefix-argument. 
> Indeed am not sure how I'd do that (to use its options). 
>
> (defun insert-date (prefix)
>     "Insert the current date. With prefix-argument, use ISO format. With
>    two prefix arguments, write out the day and month name."
>     (interactive "P")
>     (let ((format (cond
>                    ((not prefix) "%A, %d %B %Y")
>                    ((equal prefix '(4)) "%Y-%m-%d")
>                    ((equal prefix '(16)) "%A, %d. %B %Y")))
>           (system-time-locale "de_DE"))
>       (insert (format-time-string format))))

(defalias 'id 'insert-date)

M-x id RET     --> Monday, 20 September 2010
C-y M-x id RET --> 2010-09-20

-- 
__Pascal Bourguignon__                     http://www.informatimago.com/


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

* Re: help create function alias
  2010-09-20 10:43 help create function alias Adam
  2010-09-20 10:57 ` Marc Mientki
@ 2010-09-20 15:35 ` Stefan Monnier
       [not found]   ` <i78cop$ts0$1@lust.ihug.co.nz>
  2010-09-22  2:07   ` Xah Lee
  1 sibling, 2 replies; 15+ messages in thread
From: Stefan Monnier @ 2010-09-20 15:35 UTC (permalink / raw)
  To: help-gnu-emacs

> I use (insert-date) often, but rather than a hotkey I'd 
> prefer M-x id  or  ALT-x id   

How 'bout:

   (define-key minibuffer-local-completion-map
               [(meta tab)] 'minibuffer-force-complete)

and then

   M-x i-d M-TAB RET

or even

   (define-key minibuffer-local-completion-map
               [(meta return)]
               (lambda ()
                 (interactive)
                 (minibuffer-force-complete)
                 (minibuffer-complete-and-exit)))

and then

   M-x i-d M-RET


-- Stefan


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

* Re: help create function alias
  2010-09-20 14:11       ` Pascal J. Bourguignon
@ 2010-09-20 19:54         ` Adam
  2010-09-20 21:11           ` Andreas Politz
                             ` (2 more replies)
  0 siblings, 3 replies; 15+ messages in thread
From: Adam @ 2010-09-20 19:54 UTC (permalink / raw)
  To: help-gnu-emacs

Pascal J. Bourguignon wrote:

> Adam <nospam@example.com> writes:
> 
>>> Marc Mientki wrote:
>> [ ... ]
>>
>> Here's the (insert-date) function.  Which I now find doesn't
>> work when called from the changed (id) example below.
>>
>> M-x id  returns "Wrong type argument: stringp, nil"
>> Strange, as I never used M-x insert-date  with any prefix-argument.
>> Indeed am not sure how I'd do that (to use its options).
>>
>> (defun insert-date (prefix)
>>     "Insert the current date. With prefix-argument, use ISO format. With
>>    two prefix arguments, write out the day and month name."
>>     (interactive "P")
>>     (let ((format (cond
>>                    ((not prefix) "%A, %d %B %Y")
>>                    ((equal prefix '(4)) "%Y-%m-%d")
>>                    ((equal prefix '(16)) "%A, %d. %B %Y")))
>>           (system-time-locale "de_DE"))
>>       (insert (format-time-string format))))
> 
> (defalias 'id 'insert-date)
> 
> M-x id RET     --> Monday, 20 September 2010
> C-y M-x id RET --> 2010-09-20

Thanks. I saw alias somewhere recently, but couldn't 
er.. didn't find it in a search looking for it simply 
by name. 

Out of interest, how does one use the (insert-date) function 
above with a prefix ? 

e.g.  C-u 4 M-x insert-date   returns an error, and 
evaluating (insert-date 4) is not right. 










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

* Re: help create function alias
  2010-09-20 19:54         ` Adam
@ 2010-09-20 21:11           ` Andreas Politz
  2010-09-20 22:02             ` Adam
  2010-09-21  1:56           ` Barry Margolin
  2010-09-21  2:19           ` Pascal J. Bourguignon
  2 siblings, 1 reply; 15+ messages in thread
From: Andreas Politz @ 2010-09-20 21:11 UTC (permalink / raw)
  To: help-gnu-emacs

Adam <nospam@example.com> writes:

> Pascal J. Bourguignon wrote:
>
>> Adam <nospam@example.com> writes:
>> 
>>>> Marc Mientki wrote:
>>> [ ... ]
>>>
>>> Here's the (insert-date) function.  Which I now find doesn't
>>> work when called from the changed (id) example below.
>>>
>>> M-x id  returns "Wrong type argument: stringp, nil"
>>> Strange, as I never used M-x insert-date  with any prefix-argument.
>>> Indeed am not sure how I'd do that (to use its options).
>>>
>>> (defun insert-date (prefix)
>>>     "Insert the current date. With prefix-argument, use ISO format. With
>>>    two prefix arguments, write out the day and month name."
>>>     (interactive "P")
>>>     (let ((format (cond
>>>                    ((not prefix) "%A, %d %B %Y")
>>>                    ((equal prefix '(4)) "%Y-%m-%d")
>>>                    ((equal prefix '(16)) "%A, %d. %B %Y")))
>>>           (system-time-locale "de_DE"))
>>>       (insert (format-time-string format))))
>> 
>> (defalias 'id 'insert-date)
>> 
>> M-x id RET     --> Monday, 20 September 2010
>> C-y M-x id RET --> 2010-09-20
>
> Thanks. I saw alias somewhere recently, but couldn't 
> er.. didn't find it in a search looking for it simply 
> by name. 
>
> Out of interest, how does one use the (insert-date) function 
> above with a prefix ? 
>
> e.g.  C-u 4 M-x insert-date   returns an error, and 
> evaluating (insert-date 4) is not right. 

keys  |  resulting arg
C-u 4 => 4
C-u   => (4)

Since (equal 4 '(4)) is false and the cond has no default case, format
is nil and format-time-string reports an error for it.

-ap


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

* Re: help create function alias
  2010-09-20 21:11           ` Andreas Politz
@ 2010-09-20 22:02             ` Adam
  0 siblings, 0 replies; 15+ messages in thread
From: Adam @ 2010-09-20 22:02 UTC (permalink / raw)
  To: help-gnu-emacs

Andreas Politz wrote:

> Adam <nospam@example.com> writes:
> 
>> Pascal J. Bourguignon wrote:
>>
>>> Adam <nospam@example.com> writes:
>>> 
>>>>> Marc Mientki wrote:
>>>> [ ... ]
>>>>
>>>> Here's the (insert-date) function.  Which I now find doesn't
>>>> work when called from the changed (id) example below.
>>>>
>>>> M-x id  returns "Wrong type argument: stringp, nil"
>>>> Strange, as I never used M-x insert-date  with any prefix-argument.
>>>> Indeed am not sure how I'd do that (to use its options).
>>>>
>>>> (defun insert-date (prefix)
>>>>     "Insert the current date. With prefix-argument, use ISO format.
>>>>     With
>>>>    two prefix arguments, write out the day and month name."
>>>>     (interactive "P")
>>>>     (let ((format (cond
>>>>                    ((not prefix) "%A, %d %B %Y")
>>>>                    ((equal prefix '(4)) "%Y-%m-%d")
>>>>                    ((equal prefix '(16)) "%A, %d. %B %Y")))
>>>>           (system-time-locale "de_DE"))
>>>>       (insert (format-time-string format))))
>>> 
>>> (defalias 'id 'insert-date)
>>> 
>>> M-x id RET     --> Monday, 20 September 2010
>>> C-y M-x id RET --> 2010-09-20
>>
>> Thanks. I saw alias somewhere recently, but couldn't
>> er.. didn't find it in a search looking for it simply
>> by name.
>>
>> Out of interest, how does one use the (insert-date) function
>> above with a prefix ?
>>
>> e.g.  C-u 4 M-x insert-date   returns an error, and
>> evaluating (insert-date 4) is not right.
> 
> keys  |  resulting arg
> C-u 4 => 4
> C-u   => (4)
> 
> Since (equal 4 '(4)) is false and the cond has no default case, format
> is nil and format-time-string reports an error for it.
> 
> -ap

OK. But I still don't get it. How do I work 
those 2 non-nil options ?  

Or how do I work them from two custom defuns, 
say M-x id4   M-x id16  ?




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

* Re: help create function alias
       [not found]   ` <i78cop$ts0$1@lust.ihug.co.nz>
@ 2010-09-20 22:19     ` Stefan Monnier
  2010-09-20 22:41       ` Adam
  0 siblings, 1 reply; 15+ messages in thread
From: Stefan Monnier @ 2010-09-20 22:19 UTC (permalink / raw)
  To: help-gnu-emacs

>>> I use (insert-date) often, but rather than a hotkey I'd
>>> prefer M-x id  or  ALT-x id
>> How 'bout:
>> (define-key minibuffer-local-completion-map
>> [(meta tab)] 'minibuffer-force-complete)
>> 
>> and then
>> 
>> M-x i-d M-TAB RET
>> 
>> or even
>> 
>> (define-key minibuffer-local-completion-map
>> [(meta return)]
>> (lambda ()
>> (interactive)
>> (minibuffer-force-complete)
>> (minibuffer-complete-and-exit)))
>> 
>> and then
>> 
>> M-x i-d M-RET
>> 
>> 
>> -- Stefan

> Thanks, lovely stuff, but i dash d not as intuitive as 
> my desired simplistic i d mnemonic or abbreviation.

Of course.  My suggestion is not nearly as simple as the thing you
asked for.  Its main interest is that it's applicable to all commands
rather than just to insert-date.
Actually, without any change, you can already try M-x i-d TAB, tho
you'll find there are many other commands that match this pattern.

> As mentioned below, I saw alias somewhere but couldn't
> find it searching for alias* as its defalias. Beaut. 

C-h f *alias TAB will include defalias, as will M-x apropos RET alias RET


        Stefan


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

* Re: help create function alias
  2010-09-20 22:19     ` Stefan Monnier
@ 2010-09-20 22:41       ` Adam
  0 siblings, 0 replies; 15+ messages in thread
From: Adam @ 2010-09-20 22:41 UTC (permalink / raw)
  To: help-gnu-emacs

Stefan Monnier wrote:

>>>> I use (insert-date) often, but rather than a hotkey I'd
>>>> prefer M-x id  or  ALT-x id
>>> How 'bout:
>>> (define-key minibuffer-local-completion-map
>>> [(meta tab)] 'minibuffer-force-complete)
>>> 
>>> and then
>>> 
>>> M-x i-d M-TAB RET
>>> 
>>> or even
>>> 
>>> (define-key minibuffer-local-completion-map
>>> [(meta return)]
>>> (lambda ()
>>> (interactive)
>>> (minibuffer-force-complete)
>>> (minibuffer-complete-and-exit)))
>>> 
>>> and then
>>> 
>>> M-x i-d M-RET
>>> 
>>> 
>>> -- Stefan
> 
>> Thanks, lovely stuff, but i dash d not as intuitive as
>> my desired simplistic i d mnemonic or abbreviation.
> 
> Of course.  My suggestion is not nearly as simple as the thing you
> asked for.  Its main interest is that it's applicable to all commands
> rather than just to insert-date.
> Actually, without any change, you can already try M-x i-d TAB, tho
> you'll find there are many other commands that match this pattern.
> 
>> As mentioned below, I saw alias somewhere but couldn't
>> find it searching for alias* as its defalias. Beaut.
> 
> C-h f *alias TAB will include defalias, as will M-x apropos RET alias RET
> 
> 
>         Stefan

Both good revelations for me. I didn't know about the dash working 
for a double-banger completion search. Good. 

And I haven't been using M-x apropos, with wildcards. Good. 

Thanks. 



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

* Re: help create function alias
  2010-09-20 19:54         ` Adam
  2010-09-20 21:11           ` Andreas Politz
@ 2010-09-21  1:56           ` Barry Margolin
  2010-09-21  2:19           ` Pascal J. Bourguignon
  2 siblings, 0 replies; 15+ messages in thread
From: Barry Margolin @ 2010-09-21  1:56 UTC (permalink / raw)
  To: help-gnu-emacs

In article <i78deq$ue5$1@lust.ihug.co.nz>, Adam <nospam@example.com> 
wrote:

> Pascal J. Bourguignon wrote:
> 
> > Adam <nospam@example.com> writes:
> > 
> >>> Marc Mientki wrote:
> >> [ ... ]
> >>
> >> Here's the (insert-date) function.  Which I now find doesn't
> >> work when called from the changed (id) example below.
> >>
> >> M-x id  returns "Wrong type argument: stringp, nil"
> >> Strange, as I never used M-x insert-date  with any prefix-argument.
> >> Indeed am not sure how I'd do that (to use its options).
> >>
> >> (defun insert-date (prefix)
> >>     "Insert the current date. With prefix-argument, use ISO format. With
> >>    two prefix arguments, write out the day and month name."
> >>     (interactive "P")
> >>     (let ((format (cond
> >>                    ((not prefix) "%A, %d %B %Y")
> >>                    ((equal prefix '(4)) "%Y-%m-%d")
> >>                    ((equal prefix '(16)) "%A, %d. %B %Y")))
> >>           (system-time-locale "de_DE"))
> >>       (insert (format-time-string format))))
> > 
> > (defalias 'id 'insert-date)
> > 
> > M-x id RET     --> Monday, 20 September 2010
> > C-y M-x id RET --> 2010-09-20
> 
> Thanks. I saw alias somewhere recently, but couldn't 
> er.. didn't find it in a search looking for it simply 
> by name. 
> 
> Out of interest, how does one use the (insert-date) function 
> above with a prefix ? 
> 
> e.g.  C-u 4 M-x insert-date   returns an error, and 
> evaluating (insert-date 4) is not right. 

See the Emacs Lisp Reference Manual section on prefix arguments.  If you 
enter a number explicitly, the prefix argument is just the number.  But 
if you do C-u M-x insert-date or C-u C-u M-x insert-date, it puts the 
default argument in a list, which is what the function expects.

-- 
Barry Margolin, barmar@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
*** PLEASE don't copy me on replies, I'll read them in the group ***


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

* Re: help create function alias
  2010-09-20 19:54         ` Adam
  2010-09-20 21:11           ` Andreas Politz
  2010-09-21  1:56           ` Barry Margolin
@ 2010-09-21  2:19           ` Pascal J. Bourguignon
  2 siblings, 0 replies; 15+ messages in thread
From: Pascal J. Bourguignon @ 2010-09-21  2:19 UTC (permalink / raw)
  To: help-gnu-emacs

Adam <nospam@example.com> writes:

> Pascal J. Bourguignon wrote:
>
>> Adam <nospam@example.com> writes:
>> 
>>>> Marc Mientki wrote:
>>> [ ... ]
>>>
>>> Here's the (insert-date) function.  Which I now find doesn't
>>> work when called from the changed (id) example below.
>>>
>>> M-x id  returns "Wrong type argument: stringp, nil"
>>> Strange, as I never used M-x insert-date  with any prefix-argument.
>>> Indeed am not sure how I'd do that (to use its options).
>>>
>>> (defun insert-date (prefix)
>>>     "Insert the current date. With prefix-argument, use ISO format. With
>>>    two prefix arguments, write out the day and month name."
>>>     (interactive "P")
>>>     (let ((format (cond
>>>                    ((not prefix) "%A, %d %B %Y")
>>>                    ((equal prefix '(4)) "%Y-%m-%d")
>>>                    ((equal prefix '(16)) "%A, %d. %B %Y")))
>>>           (system-time-locale "de_DE"))
>>>       (insert (format-time-string format))))
>> 
>> (defalias 'id 'insert-date)
>> 
>> M-x id RET     --> Monday, 20 September 2010
>> C-y M-x id RET --> 2010-09-20
>
> Thanks. I saw alias somewhere recently, but couldn't 
> er.. didn't find it in a search looking for it simply 
> by name. 
>
> Out of interest, how does one use the (insert-date) function 
> above with a prefix ? 
>
> e.g.  C-u 4 M-x insert-date   returns an error, and 
> evaluating (insert-date 4) is not right. 

Sorry, I meant C-u, not C-y.  A raw prefix is just C-u.

-- 
__Pascal Bourguignon__                     http://www.informatimago.com/


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

* Re: help create function alias
  2010-09-20 15:35 ` Stefan Monnier
       [not found]   ` <i78cop$ts0$1@lust.ihug.co.nz>
@ 2010-09-22  2:07   ` Xah Lee
  2010-09-24  0:11     ` Stefan Monnier
  2010-12-09 21:35     ` Drew Adams
  1 sibling, 2 replies; 15+ messages in thread
From: Xah Lee @ 2010-09-22  2:07 UTC (permalink / raw)
  To: help-gnu-emacs

On Sep 20, 8:35 am, Stefan Monnier <monn...@iro.umontreal.ca> wrote:
> > I use (insert-date) often, but rather than a hotkey I'd
> > prefer M-x id  or  ALT-x id  
>
> How 'bout:
>
>    (define-key minibuffer-local-completion-map
>                [(meta tab)] 'minibuffer-force-complete)
>
> and then
>
>    M-x i-d M-TAB RET
>
> or even
>
>    (define-key minibuffer-local-completion-map
>                [(meta return)]
>                (lambda ()
>                  (interactive)
>                  (minibuffer-force-complete)
>                  (minibuffer-complete-and-exit)))
>
> and then
>
>    M-x i-d M-RET
>
> -- Stefan

would it be nice to have a general mechanism to execute commands with
just their inits?

maybe a command named “execute-extended-command-by-init” with a
keybinding.

e.g. i have lots aliases:

; shortening of often used commands
(defalias 'rn 'wdired-change-to-wdired-mode) ; rename file in dired

(defalias 'dj 'dired-jump)
(defalias 'g 'grep)
(defalias 'gf 'grep-find)
(defalias 'fd 'find-dired)
(defalias 'ntr 'narrow-to-region)
(defalias 'lml 'list-matching-lines2)
(defalias 'dml 'delete-matching-lines)
(defalias 'dnml 'delete-non-matching-lines)
(defalias 'sl 'sort-lines)
(defalias 'dtw 'delete-trailing-whitespace)
(defalias 'lcd 'list-colors-display)
(defalias 'rb 'revert-buffer)

(defalias 'sh 'shell)
(defalias 'ps 'powershell)
(defalias 'fb 'flyspell-buffer)

(defalias 'rof 'recentf-open-files)

; elisp
(defalias 'eb 'eval-buffer)
(defalias 'er 'eval-region)
(defalias 'ed 'eval-defun)
(defalias 'eis 'elisp-index-search)

; modes
(defalias 'hm 'html-mode)
(defalias 'tm 'text-mode)
(defalias 'elm 'emacs-lisp-mode)
(defalias 'vbm 'visual-basic-mode)
(defalias 'vlm 'visual-line-mode)
(defalias 'wsm 'whitespace-mode)
(defalias 'om 'org-mode)
(defalias 'ssm 'shell-script-mode)
(defalias 'cc 'calc)

(defalias 'rs 'replace-string)

plus about 40 more on personal commands...

«maybe a command named “execute-extended-command-by-init” with a
keybinding.»

humm.. actually does that exist somewhere? seems not hard to write...

i guess i could write a command that take input and insert “*” between
letters than feed it to execute-extended-command?

 Xah ∑ xahlee.org ☄


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

* Re: help create function alias
  2010-09-22  2:07   ` Xah Lee
@ 2010-09-24  0:11     ` Stefan Monnier
  2010-12-09 21:35     ` Drew Adams
  1 sibling, 0 replies; 15+ messages in thread
From: Stefan Monnier @ 2010-09-24  0:11 UTC (permalink / raw)
  To: help-gnu-emacs

>>    (define-key minibuffer-local-completion-map
>>                [(meta tab)] 'minibuffer-force-complete)
[...]
> would it be nice to have a general mechanism to execute commands with
> just their inits?

It should be fairly easy to come up with an ad-hoc completion command
for intitials-only based on the `initials' completion-style, coupled
with minibuffer-force-complete.  I.e. something along the lines of

(defun 100%-untested-initials-completion-command ()
  "No docstring."
  (interactive)
  (let ((completion-styles '(initials)))
    (minibuffer-force-complete)))

which you then would want to bind somewhere in the keymap used by M-x


        Stefan


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

* RE: help create function alias
  2010-09-22  2:07   ` Xah Lee
  2010-09-24  0:11     ` Stefan Monnier
@ 2010-12-09 21:35     ` Drew Adams
  1 sibling, 0 replies; 15+ messages in thread
From: Drew Adams @ 2010-12-09 21:35 UTC (permalink / raw)
  To: 'Xah Lee', help-gnu-emacs

(`x' = Xah; `s' = Stefan.)

x> would it be nice to have a general mechanism to execute commands with
x> just their inits?  maybe a command named
x> "execute-extended-command-by-init" with a keybinding. e.g. i have
x> lots aliases:
x> ; shortening of often used commands
x> (defalias 'rn 'wdired-change-to-wdired-mode)
x> (defalias 'dj 'dired-jump)
...
x> plus about 40 more on personal commands...
x> 
x> <maybe a command named "execute-extended-command-by-init" with a
x> keybinding.>
x> humm.. actually does that exist somewhere? seems not hard to write...


s> >> (define-key minibuffer-local-completion-map
s> >> [(meta return)]
s> >> (lambda ()
s> >> (interactive)
s> >> (minibuffer-force-complete)
s> >> (minibuffer-complete-and-exit)))
s> >> and then M-x i-d M-RET
> 
> > Thanks, lovely stuff, but i dash d not as intuitive as 
> > my desired simplistic i d mnemonic or abbreviation.
s> 
s> Of course.  My suggestion is not nearly as simple as the thing you
s> asked for.  Its main interest is that it's applicable to all commands
s> rather than just to insert-date.
s> Actually, without any change, you can already try M-x i-d TAB, tho
s> you'll find there are many other commands that match this pattern.


In Icicles, you can use `C-x SPC' (by default) instead of `M-x', to execute both
commands and command abbreviations, using completion.  The completion is lax, so
you can even create new command abbreviations on the fly.  (You can also create
or edit abbreviations using Customize.)

http://www.emacswiki.org/emacs/Icicles_-_Multi_M-x#toc6






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

end of thread, other threads:[~2010-12-09 21:35 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-09-20 10:43 help create function alias Adam
2010-09-20 10:57 ` Marc Mientki
2010-09-20 11:46   ` Adam
     [not found]     ` <i77ma9$h97$1@lust.ihug.co.nz>
2010-09-20 14:11       ` Pascal J. Bourguignon
2010-09-20 19:54         ` Adam
2010-09-20 21:11           ` Andreas Politz
2010-09-20 22:02             ` Adam
2010-09-21  1:56           ` Barry Margolin
2010-09-21  2:19           ` Pascal J. Bourguignon
2010-09-20 15:35 ` Stefan Monnier
     [not found]   ` <i78cop$ts0$1@lust.ihug.co.nz>
2010-09-20 22:19     ` Stefan Monnier
2010-09-20 22:41       ` Adam
2010-09-22  2:07   ` Xah Lee
2010-09-24  0:11     ` Stefan Monnier
2010-12-09 21:35     ` Drew Adams

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.