[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: how to store a elisp procedure in a file and recall it typing a key
From: |
Doug Lewan |
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 |
> -----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.