all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Xah Lee <xahlee@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Re: help create function alias
Date: Tue, 21 Sep 2010 19:07:06 -0700 (PDT)	[thread overview]
Message-ID: <962ba4f8-c462-455c-bf06-4c3149f7680d@h37g2000pro.googlegroups.com> (raw)
In-Reply-To: jwvlj6w1li8.fsf-monnier+gnu.emacs.help@gnu.org

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 ☄


  parent reply	other threads:[~2010-09-22  2:07 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2010-09-24  0:11     ` Stefan Monnier
2010-12-09 21:35     ` Drew Adams

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=962ba4f8-c462-455c-bf06-4c3149f7680d@h37g2000pro.googlegroups.com \
    --to=xahlee@gmail.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.
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.