help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: A valid example of kbd macros - take that, Emanuel! ;-)


From: Emanuel Berg
Subject: Re: A valid example of kbd macros - take that, Emanuel! ;-)
Date: Thu, 30 Jul 2015 00:34:46 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux)

Marcin Borkowski <mbork@mbork.pl> writes:

> Well, I know it can be done, obviously. The question
> is: how much time does it take to find all these
> Elisp functions? (Unless you know them already.)

I always do things, or try to do them, the *right*
way. Sometimes the inferior way is indeed faster.

If you are in a cabin and you need to hit a nail into
a wall, but you don't have a hammer, instead of using
the back side of the ax, I go to the other cabin and
get the hammer. It is more enjoyable, more precise,
and even tho in that particular case the ax solution
would be more quick, in the end the right way (get the
hammer) will be even quicker because then I will
realize I need a hammer in *both* cabins!

Correspondingly, now I have

    (require 'gnus-msg)
    (require 'cl-macs)
    (require 'message)

    (defun mail-to-many (to subject body)
      (cl-dolist (this-to to)
        (gnus-post-news 'post "")
        (message-goto-to)          (insert this-to)
        (message-goto-subject)     (insert subject)
        (message-goto-body)        (insert body)
        (message-send-and-exit) ))

so the next time I want it (or someone on this list
wants it) I can use/share it in one second.

And even if I never use or share it again, I may
encounter a situation that is similar - then I'll
bring up the code, be reminded of say those
message-goto's, and I'll be able to solve the
other problem - faster, and better.

So no - I don't focus on speed per se, but still, in
time speed will enter through the back door.

(In this case I actually think using a "To:" header
with commas is the right way to send the same mail to
several persons, but nevermind.)

> (And you cheated a bit: I didn't have my data in
> a Lisp list, but in an Org table. Next level of
> function-searching.)

I don't use Org but if there isn't a way already to
extract data into a list then it is terribly
disorganized despite its name. But I don't think it
is: more likely the data is already in a list!

> And more importantly: /why/ do it if you don't have
> to? ("Fun", "learning" and "this I may need in the
> future" are legitimiate responses, of course, but
> "No need to" is, too.)

What you mention, yes. But also enjoyment, and how to
deal with the outcome, be it good or bad. If I hit the
nail with the ax and the nail bends, or the ax breaks,
I'll be angry and disappointed at myself. If that
happens with the hammer: so what? Even the master
carpenter breaks his tools when they are worn out!

On the other hand, with the ax, say every thing works
perfectly, and then some guys come my way and say this
cabin looks amazing. Then I don't want to look down
the floor knowing I actually used an ax for all the
nails, hoping they won't notice!

With mechanics, cabin work, etc. sometimes the right
tools are too expensive, too big and heavy, lost, or
whatever. But with Emacs and Elisp programming that is
never a problem. So I'm in a real good place to have
this attitude. But even with computers, you have to be
well-organized yourself even tho it is much easier
than in the workshop or forest :)

-- 
underground experts united
http://user.it.uu.se/~embe8573




reply via email to

[Prev in Thread] Current Thread [Next in Thread]