all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Couple of automation questions
@ 2011-07-27  5:31 C K Kashyap
  2011-07-27  7:16 ` Andreas Röhler
  2011-07-27  7:27 ` Teemu Likonen
  0 siblings, 2 replies; 13+ messages in thread
From: C K Kashyap @ 2011-07-27  5:31 UTC (permalink / raw
  To: help-gnu-emacs

[-- Attachment #1: Type: text/plain, Size: 541 bytes --]

Hi,
I have a situation where I need to "beautify" a log file quite often. I need
to do the same set of steps.
What is the recommended best practices for the following approaches -
1. Keyboard Macro
What is the way to save the macro to disk? Do we open a new buffer (or a
buffer that contains all keyboard macros) and then insert it there and save
it?

2. Scripting
Whats the recommended way to get started with scripting? Do I open up a
buffer and start typing? I dont seem to get function name completion in a
new buffer.

Regards,
Kashyap

[-- Attachment #2: Type: text/html, Size: 684 bytes --]

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

* Re: Couple of automation questions
  2011-07-27  5:31 Couple of automation questions C K Kashyap
@ 2011-07-27  7:16 ` Andreas Röhler
  2011-07-27  7:27 ` Teemu Likonen
  1 sibling, 0 replies; 13+ messages in thread
From: Andreas Röhler @ 2011-07-27  7:16 UTC (permalink / raw
  To: help-gnu-emacs

Am 27.07.2011 07:31, schrieb C K Kashyap:
> Hi,
> I have a situation where I need to "beautify" a log file quite often. I need
> to do the same set of steps.
> What is the recommended best practices for the following approaches -
> 1. Keyboard Macro
> What is the way to save the macro to disk?

21.5 Naming and Saving Keyboard Macros
======================================

Do we open a new buffer (or a
> buffer that contains all keyboard macros) and then insert it there and save
> it?
>
> 2. Scripting
> Whats the recommended way to get started with scripting? Do I open up a
> buffer and start typing? I dont seem to get function name completion in a
> new buffer.

Don't care for things like that at the beginning.

See doku of

M-x dabbrev-expand

it will do all you need at this point and context.

Andreas

>
> Regards,
> Kashyap
>




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

* Re: Couple of automation questions
  2011-07-27  5:31 Couple of automation questions C K Kashyap
  2011-07-27  7:16 ` Andreas Röhler
@ 2011-07-27  7:27 ` Teemu Likonen
  2011-07-27  8:11   ` C K Kashyap
  1 sibling, 1 reply; 13+ messages in thread
From: Teemu Likonen @ 2011-07-27  7:27 UTC (permalink / raw
  To: C. K. Kashyap; +Cc: help-gnu-emacs

* 2011-07-27T11:01:18+05:30 * C. K. Kashyap wrote:

> Hi,
> I have a situation where I need to "beautify" a log file quite often. I need
> to do the same set of steps.
> What is the recommended best practices for the following approaches -

> 1. Keyboard Macro
> What is the way to save the macro to disk? Do we open a new buffer (or a
> buffer that contains all keyboard macros) and then insert it there and save
> it?

See the info node

    C-h i g (emacs) Save Keyboard Macro RET

> 2. Scripting
> Whats the recommended way to get started with scripting? Do I open up a
> buffer and start typing? I dont seem to get function name completion in a
> new buffer.

"Scripting" in Emacs is actually programming in Emacs Lisp. To get
started with Emacs Lisp I suggest reading "An Introduction to
Programming in Emacs Lisp" and of course the Emacs Lisp reference
manual.

    C-h i g (eintr) Top RET
    C-h i g (elisp) Top RET



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

* Re: Couple of automation questions
  2011-07-27  7:27 ` Teemu Likonen
@ 2011-07-27  8:11   ` C K Kashyap
  2011-07-27  8:28     ` Teemu Likonen
                       ` (2 more replies)
  0 siblings, 3 replies; 13+ messages in thread
From: C K Kashyap @ 2011-07-27  8:11 UTC (permalink / raw
  To: Teemu Likonen; +Cc: help-gnu-emacs

[-- Attachment #1: Type: text/plain, Size: 709 bytes --]

>
>
> "Scripting" in Emacs is actually programming in Emacs Lisp. To get
> started with Emacs Lisp I suggest reading "An Introduction to
> Programming in Emacs Lisp" and of course the Emacs Lisp reference
> manual.
>
>    C-h i g (eintr) Top RET
>    C-h i g (elisp) Top RET
>

Thanks Teemu ... I am aware of elisp. What I am looking for are general tips
on how one goes about actually writing them in real time ( while editing
some text) ... for example, if I do a kill and want to yank 10 times, What
I'd do is M-:(dotimes (i 10) (yank))

but is that the recommended way or would writing the script in the main
buffer and executing it with C-x-e better ... or is there an even better
way?

Regards,
Kashyap

[-- Attachment #2: Type: text/html, Size: 1012 bytes --]

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

* Re: Couple of automation questions
  2011-07-27  8:11   ` C K Kashyap
@ 2011-07-27  8:28     ` Teemu Likonen
  2011-07-27 14:26     ` Memnon Anon
  2011-07-27 16:52     ` fork
  2 siblings, 0 replies; 13+ messages in thread
From: Teemu Likonen @ 2011-07-27  8:28 UTC (permalink / raw
  To: C. K. Kashyap; +Cc: help-gnu-emacs

* 2011-07-27T13:41:29+05:30 * C. K. Kashyap wrote:

> Thanks Teemu ... I am aware of elisp. What I am looking for are
> general tips on how one goes about actually writing them in real time
> ( while editing some text) ... for example, if I do a kill and want to
> yank 10 times, What I'd do is M-:(dotimes (i 10) (yank))
>
> but is that the recommended way or would writing the script in the
> main buffer and executing it with C-x-e better ... or is there an even
> better way?

There are options. I'd say that do what you feel is comfortable to you.
I'll just add another option: write and define an interactive function
in the *scratch* buffer and then execute it (M-x ...) in the target
buffer.



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

* Re: Couple of automation questions
  2011-07-27  8:11   ` C K Kashyap
  2011-07-27  8:28     ` Teemu Likonen
@ 2011-07-27 14:26     ` Memnon Anon
  2011-07-27 16:52     ` fork
  2 siblings, 0 replies; 13+ messages in thread
From: Memnon Anon @ 2011-07-27 14:26 UTC (permalink / raw
  To: help-gnu-emacs

C K Kashyap <ckkashyap@gmail.com> writes:

> ... I am aware of elisp. What I am looking for are general tips on how
> one goes about actually writing them in real time ( while editing some
> text) ... for example, if I do a kill and want to yank 10 times, What
> I'd do is M-:(dotimes (i 10) (yank))

http://www.masteringemacs.org/articles/2010/11/29/evaluating-elisp-emacs/

should give you some ideas.

I'd say it depends on how complex the elisp is.

Memnon





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

* Re: Couple of automation questions
  2011-07-27  8:11   ` C K Kashyap
  2011-07-27  8:28     ` Teemu Likonen
  2011-07-27 14:26     ` Memnon Anon
@ 2011-07-27 16:52     ` fork
  2011-07-27 17:06       ` Teemu Likonen
  2011-07-27 17:28       ` Andreas Röhler
  2 siblings, 2 replies; 13+ messages in thread
From: fork @ 2011-07-27 16:52 UTC (permalink / raw
  To: help-gnu-emacs

C K Kashyap <ckkashyap <at> gmail.com> writes:

> Thanks Teemu ... I am aware of elisp. What I am looking for are general tips
on how one goes about actually writing them in real time ( while editing some
text) ... for example, if I do a kill and want to yank 10 times, What I'd do is
M-:(dotimes (i 10) (yank))
> 
> but is that the recommended way or would writing the script in the main buffer
and executing it with C-x-e better ... or is there an even better way?

What I do is to improvise a macro by C-x-( etc.  Then you can "M-x
name-last-kbd-macro" to give it an identifier "M-x insert-kbd-macro" put the
macro in your .emacs file for later.

sed + awk + tr + shell scripting might be a better fit for automatically
beautifying log files though




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

* Re: Couple of automation questions
  2011-07-27 16:52     ` fork
@ 2011-07-27 17:06       ` Teemu Likonen
  2011-07-27 17:23         ` fork
  2011-07-27 17:28       ` Andreas Röhler
  1 sibling, 1 reply; 13+ messages in thread
From: Teemu Likonen @ 2011-07-27 17:06 UTC (permalink / raw
  To: fork; +Cc: help-gnu-emacs

* 2011-07-27T16:52:35Z * fork wrote:

> sed + awk + tr + shell scripting might be a better fit for
> automatically beautifying log files though

We are Lisp people, right? Then we could use Common Lisp too.



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

* Re: Couple of automation questions
  2011-07-27 17:06       ` Teemu Likonen
@ 2011-07-27 17:23         ` fork
  0 siblings, 0 replies; 13+ messages in thread
From: fork @ 2011-07-27 17:23 UTC (permalink / raw
  To: help-gnu-emacs

Teemu Likonen <tlikonen <at> iki.fi> writes:

> > sed + awk + tr + shell scripting might be a better fit for
> > automatically beautifying log files though
> 
> We are Lisp people, right? Then we could use Common Lisp too.

Indeed!  Often it is a trade off between aesthetics and pragmatics, but in terms
of grace, Lisp is the hands down winner in that match up.




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

* Re: Couple of automation questions
  2011-07-27 16:52     ` fork
  2011-07-27 17:06       ` Teemu Likonen
@ 2011-07-27 17:28       ` Andreas Röhler
  2011-07-28  2:40         ` C K Kashyap
  1 sibling, 1 reply; 13+ messages in thread
From: Andreas Röhler @ 2011-07-27 17:28 UTC (permalink / raw
  To: help-gnu-emacs

Am 27.07.2011 18:52, schrieb fork:
> C K Kashyap<ckkashyap<at>  gmail.com>  writes:
>
>> Thanks Teemu ... I am aware of elisp. What I am looking for are general tips
> on how one goes about actually writing them in real time ( while editing some
> text) ... for example, if I do a kill and want to yank 10 times, What I'd do is
> M-:(dotimes (i 10) (yank))
>>
>> but is that the recommended way or would writing the script in the main buffer
> and executing it with C-x-e better ... or is there an even better way?
>
> What I do is to improvise a macro by C-x-( etc.  Then you can "M-x
> name-last-kbd-macro" to give it an identifier "M-x insert-kbd-macro" put the
> macro in your .emacs file for later.
>
> sed + awk + tr + shell scripting might be a better fit for automatically
> beautifying log files though
>
>
>

yes maybe, if the tasks repeat and are basically simple. Than you could 
use some python or perl too.

no, if it's seldom or tricky.

sed, awk etc. don't have such a thing like edebug for example.

Andreas



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

* Re: Couple of automation questions
  2011-07-27 17:28       ` Andreas Röhler
@ 2011-07-28  2:40         ` C K Kashyap
  2011-07-28  6:05           ` Teemu Likonen
  2011-07-28  6:56           ` Andreas Röhler
  0 siblings, 2 replies; 13+ messages in thread
From: C K Kashyap @ 2011-07-28  2:40 UTC (permalink / raw
  To: Andreas Röhler; +Cc: help-gnu-emacs

[-- Attachment #1: Type: text/plain, Size: 451 bytes --]

>
>
> yes maybe, if the tasks repeat and are basically simple. Than you could use
> some python or perl too.
>
> no, if it's seldom or tricky.
>
> sed, awk etc. don't have such a thing like edebug for example.
>
> Andreas
>
>
Hey Andreas,
You are saying that if the task is not simple then lisp would be a better
way to go right?

Hey Teemu  ... Are you suggesting common lisp because emacs lisp would fall
short in some situations?

Regards,
Kashyap

[-- Attachment #2: Type: text/html, Size: 780 bytes --]

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

* Re: Couple of automation questions
  2011-07-28  2:40         ` C K Kashyap
@ 2011-07-28  6:05           ` Teemu Likonen
  2011-07-28  6:56           ` Andreas Röhler
  1 sibling, 0 replies; 13+ messages in thread
From: Teemu Likonen @ 2011-07-28  6:05 UTC (permalink / raw
  To: C. K. Kashyap; +Cc: help-gnu-emacs

* 2011-07-28T08:10:42+05:30 * C. K. Kashyap wrote:

> Hey Teemu ... Are you suggesting common lisp because emacs lisp would
> fall short in some situations?

I was just pointing out that there are Lisps outside Emacs too. If we
suggest to others or choose a programming language outside Emacs it
might be Common Lisp.



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

* Re: Couple of automation questions
  2011-07-28  2:40         ` C K Kashyap
  2011-07-28  6:05           ` Teemu Likonen
@ 2011-07-28  6:56           ` Andreas Röhler
  1 sibling, 0 replies; 13+ messages in thread
From: Andreas Röhler @ 2011-07-28  6:56 UTC (permalink / raw
  To: C K Kashyap; +Cc: help-gnu-emacs

Am 28.07.2011 04:40, schrieb C K Kashyap:
>>
>>
>> yes maybe, if the tasks repeat and are basically simple. Than you could use
>> some python or perl too.
>>
>> no, if it's seldom or tricky.
>>
>> sed, awk etc. don't have such a thing like edebug for example.
>>
>> Andreas
>>
>>
> Hey Andreas,
> You are saying that if the task is not simple then lisp would be a better
> way to go right?
>

That way. These questions are pretty general. Finally every task 
deserves it's own choice and consideration.

Many tools are able doing the same or similar things.
Right decision will depend on your experience, knowledge, further 
prospects etc.

I'm using all mentioned so far.

If you may select some output with fields, awk always is nice to use for 
example.

Well, awk from an shell inside Emacs, sure, which helps editing a lot.


> Hey Teemu  ... Are you suggesting common lisp because emacs lisp would fall
> short in some situations?
>
> Regards,
> Kashyap
>




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

end of thread, other threads:[~2011-07-28  6:56 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-07-27  5:31 Couple of automation questions C K Kashyap
2011-07-27  7:16 ` Andreas Röhler
2011-07-27  7:27 ` Teemu Likonen
2011-07-27  8:11   ` C K Kashyap
2011-07-27  8:28     ` Teemu Likonen
2011-07-27 14:26     ` Memnon Anon
2011-07-27 16:52     ` fork
2011-07-27 17:06       ` Teemu Likonen
2011-07-27 17:23         ` fork
2011-07-27 17:28       ` Andreas Röhler
2011-07-28  2:40         ` C K Kashyap
2011-07-28  6:05           ` Teemu Likonen
2011-07-28  6:56           ` Andreas Röhler

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.