help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: help create function alias


From: Xah Lee
Subject: Re: help create function alias
Date: Wed, 08 Dec 2010 15:29:17 -0000
User-agent: G2/1.0

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 ☄


reply via email to

[Prev in Thread] Current Thread [Next in Thread]