all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Doug Lewan <dougl@shubertticketing.com>
To: "renato.pontefice@gmail.com" <renato.pontefice@gmail.com>,
	"help-gnu-emacs@gnu.org" <help-gnu-emacs@gnu.org>
Subject: RE: how to store a elisp procedure in a file and recall it typing a key
Date: Thu, 4 Sep 2014 13:50:04 +0000	[thread overview]
Message-ID: <155DEC68569B714B86C2C7075F5EDA9892B1AC7A@DAKIYA1.pegasus.local> (raw)
In-Reply-To: <069edcf2-9cff-44cb-ac09-010733fe9ceb@googlegroups.com>


> -----Original Message-----
> Sent: Wednesday, 2014 September 03 06:05
> > Subject: how to store a elisp procedure in a file and recall it typing
> a key
> 
> Hi,
> I would store, the piece of code made in elisp, and recall it by
> pressing a some special key:
> i.e.
> my elisp procedure does a control on the file where it is executed, so
> if I open a text file, I would made that control on that file.
> How can i recall it?
> I do not find the way, asking togoogle :-(

Renato,

This sounds like autoload to me: info '(elisp) Autoload'.

From the *info*: 

     This function defines the function (or macro) named FUNCTION so as
     to load automatically from FILENAME.

Here's an example.

File ~/tmp/aaa.el:
    (defun blah ()
      (interactive)
      (message "Congratulations! M-x blah is now loaded."))

Now, in your *scratch* buffer evaluate the following:
(autoload 'blah "~/tmp/aaa.el" "Demonstrate autoloading." t nil)
(local-set-key "\M-\C-Y" 'blah)

The key sequence M-C-Y will now run the command blah, loading it if necessary.

,Doug
Douglas Lewan
Shubert Ticketing
(201) 489-8600 ext 224 or ext 4335

"This is a slow pup," he said continuing his ascent.




      parent reply	other threads:[~2014-09-04 13:50 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-03 10:05 how to store a elisp procedure in a file and recall it typing a key renato.pontefice
2014-09-03 16:27 ` Emanuel Berg
2014-09-04  5:09 ` Kevin Rodgers
2014-09-04 13:50 ` Doug Lewan [this message]

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=155DEC68569B714B86C2C7075F5EDA9892B1AC7A@DAKIYA1.pegasus.local \
    --to=dougl@shubertticketing.com \
    --cc=help-gnu-emacs@gnu.org \
    --cc=renato.pontefice@gmail.com \
    /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.