all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* how to store a elisp procedure in a file and recall it typing a key
@ 2014-09-03 10:05 renato.pontefice
  2014-09-03 16:27 ` Emanuel Berg
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: renato.pontefice @ 2014-09-03 10:05 UTC (permalink / raw)
  To: help-gnu-emacs

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 :-(


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

* Re: how to store a elisp procedure in a file and recall it typing a key
  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
  2 siblings, 0 replies; 4+ messages in thread
From: Emanuel Berg @ 2014-09-03 16:27 UTC (permalink / raw)
  To: help-gnu-emacs

renato.pontefice@gmail.com writes:

> Hi, I would store, the piece of code made in elisp,
> and recall it by pressing a some special key: I do
> not find the way, asking togoogle :-(

What? :)

You want to put Elisp code in a file, and then execute
if from Emacs?

Or from the shell?

> 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 don't understand what you want to do. (I'm pretty
sure what you want to do is possible, though.)

-- 
underground experts united


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

* Re: how to store a elisp procedure in a file and recall it typing a key
  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
  2 siblings, 0 replies; 4+ messages in thread
From: Kevin Rodgers @ 2014-09-04  5:09 UTC (permalink / raw)
  To: help-gnu-emacs

On 9/3/14 4:05 AM, renato.pontefice@gmail.com wrote:
> 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 :-(

Try the Emacs documentation itself first -- in this case, the "Writing
Defuns" node of the Emacs Lisp Intro manual seems to be the best place
to start.

Here's a starting point (in case it's not obvious, you would store this
in your ~/.emacs file):

(defun my-command ()
   "Does a control on the current buffer."
   (some-elisp-function)
   (some-other-elisp-function and-its-argument and-its-other-argument))

(global-set-key "\C-ca" 'my-command)

-- 
Kevin Rodgers
Denver, Colorado, USA




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

* RE: how to store a elisp procedure in a file and recall it typing a key
  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
  2 siblings, 0 replies; 4+ messages in thread
From: Doug Lewan @ 2014-09-04 13:50 UTC (permalink / raw)
  To: renato.pontefice@gmail.com, help-gnu-emacs@gnu.org


> -----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.




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

end of thread, other threads:[~2014-09-04 13:50 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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

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.