* strange behaviour in keyboard macro
@ 2017-07-30 5:51 Héctor Lahoz
2017-07-30 7:26 ` Emanuel Berg
0 siblings, 1 reply; 10+ messages in thread
From: Héctor Lahoz @ 2017-07-30 5:51 UTC (permalink / raw)
To: help-gnu-emacs
I saved a keyboard macro like this:
<<search-forward>> ;; search-forward
Priority: ;; self-insert-command * 9
SPC ;; self-insert-command
required ;; self-insert-command * 8
RET ;; newline
<<backward-paragraph>> ;; backward-paragraph
C-n ;; next-line
<<search-forward>> ;; search-forward
: ;; self-insert-command
SPC ;; self-insert-command
RET ;; newline
When I execute it sometimes it does what I mean and the cursor ends on the right line.
But sometimes it ends (erroneously) on the following line. For example (I added numbers
for reference):
1: Package: mypkg
2: xxxxxxxxxxxxxx
3: xxxxxxxxxxxxxx
4: Priority: normal
5:
6: Package: mypkg2
7: xxxxxxxxxxxxxx
8: Priority: required
backward-paragraph should set the cursor at line 5 (blank line) so
cursor should end up at line 6.
At first it seemed random. Then I tried to find a pattern and found
out that it has something to do with text scrolling. When I repeat the
macro starting at a distant point (like half the window size) I manage
to get alternating results, that is, with one execution it ends at
line 6 and with the next execution (reseting the start position) it
ends at line 7.
Emacs version 24.4.1. Fundamental mode.
Is this a bug? I think with emacs 23 it worked fine.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: strange behaviour in keyboard macro
2017-07-30 5:51 strange behaviour in keyboard macro Héctor Lahoz
@ 2017-07-30 7:26 ` Emanuel Berg
2017-07-30 10:01 ` Héctor Lahoz
0 siblings, 1 reply; 10+ messages in thread
From: Emanuel Berg @ 2017-07-30 7:26 UTC (permalink / raw)
To: help-gnu-emacs
Héctor Lahoz wrote:
> I saved a keyboard macro [...]
Rewrite it an Elisp function and voilà probably
you can work out debugging without us :)
--
underground experts united
http://user.it.uu.se/~embe8573
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: strange behaviour in keyboard macro
2017-07-30 7:26 ` Emanuel Berg
@ 2017-07-30 10:01 ` Héctor Lahoz
2017-07-30 13:46 ` Emanuel Berg
2017-07-30 13:50 ` Emanuel Berg
0 siblings, 2 replies; 10+ messages in thread
From: Héctor Lahoz @ 2017-07-30 10:01 UTC (permalink / raw)
To: help-gnu-emacs
Emanuel Berg wrote:
> Héctor Lahoz wrote:
>
> > I saved a keyboard macro [...]
>
> Rewrite it an Elisp function and voilà probably
> you can work out debugging without us :)
Yes, it's not very long. But I wanted to do it
quickly without programming. Then, what's the
point of having keyboard macros?
For the time being I came through by using
<<search-backward>> ;; search-backward
C-q ;; quoted-insert
LFD ;; nroff-electric-newline
C-q ;; quoted-insert
LFD ;; nroff-electric-newline
RET ;; newline
instead of "backward-paragraph".
I hate when programs don't behave as I expect.
Especially with Emacs :-) Although most of the
time it is because I don't understand them.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: strange behaviour in keyboard macro
2017-07-30 10:01 ` Héctor Lahoz
@ 2017-07-30 13:46 ` Emanuel Berg
2017-07-30 20:19 ` Marcin Borkowski
2017-07-30 13:50 ` Emanuel Berg
1 sibling, 1 reply; 10+ messages in thread
From: Emanuel Berg @ 2017-07-30 13:46 UTC (permalink / raw)
To: help-gnu-emacs
Héctor Lahoz wrote:
>> Rewrite it an Elisp function and voilà
>> probably you can work out debugging without
>> us :)
>
> Yes, it's not very long. But I wanted to do
> it quickly without programming. Then, what's
> the point of having keyboard macros?
None whatsoever for people like you who know
how to program.
--
underground experts united
http://user.it.uu.se/~embe8573
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: strange behaviour in keyboard macro
2017-07-30 10:01 ` Héctor Lahoz
2017-07-30 13:46 ` Emanuel Berg
@ 2017-07-30 13:50 ` Emanuel Berg
1 sibling, 0 replies; 10+ messages in thread
From: Emanuel Berg @ 2017-07-30 13:50 UTC (permalink / raw)
To: help-gnu-emacs
Héctor Lahoz wrote:
> I hate when programs don't behave as
> I expect.
Agree 100%
> Although most of the time it is because
> I don't understand them.
*All* of the time!
Some people say the whole universe is
deterministic. And at least they are correct
with respect to computers! That's the
whole foundation.
--
underground experts united
http://user.it.uu.se/~embe8573
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: strange behaviour in keyboard macro
2017-07-30 13:46 ` Emanuel Berg
@ 2017-07-30 20:19 ` Marcin Borkowski
2017-07-30 21:47 ` Emanuel Berg
0 siblings, 1 reply; 10+ messages in thread
From: Marcin Borkowski @ 2017-07-30 20:19 UTC (permalink / raw)
To: Emanuel Berg; +Cc: help-gnu-emacs
On 2017-07-30, at 15:46, Emanuel Berg <moasen@zoho.com> wrote:
> Héctor Lahoz wrote:
>
>>> Rewrite it an Elisp function and voilà
>>> probably you can work out debugging without
>>> us :)
>>
>> Yes, it's not very long. But I wanted to do
>> it quickly without programming. Then, what's
>> the point of having keyboard macros?
>
> None whatsoever for people like you who know
> how to program.
Speed.
Best,
--
Marcin Borkowski
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: strange behaviour in keyboard macro
2017-07-30 20:19 ` Marcin Borkowski
@ 2017-07-30 21:47 ` Emanuel Berg
2017-07-31 4:40 ` Marcin Borkowski
0 siblings, 1 reply; 10+ messages in thread
From: Emanuel Berg @ 2017-07-30 21:47 UTC (permalink / raw)
To: help-gnu-emacs
Marcin Borkowski wrote:
>>> Yes, it's not very long. But I wanted to do
>>> it quickly without programming. Then,
>>> what's the point of having keyboard macros?
>>
>> None whatsoever for people like you who know
>> how to program.
>
> Speed.
Not in the medium or long run as you get better
with Elisp, and keyboard macros are much more
difficult to adapt/debug.
There is the ELPA and MELPA with readily
transferable Elisp for a reason. But where do
you guys get your keyboard macros?
The port block?
Learn to type really, really fast. Use Elisp
whenever it isn't fast enough. Speed kills.
--
underground experts united
http://user.it.uu.se/~embe8573
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: strange behaviour in keyboard macro
2017-07-30 21:47 ` Emanuel Berg
@ 2017-07-31 4:40 ` Marcin Borkowski
2017-07-31 9:19 ` Emanuel Berg
0 siblings, 1 reply; 10+ messages in thread
From: Marcin Borkowski @ 2017-07-31 4:40 UTC (permalink / raw)
To: Emanuel Berg; +Cc: help-gnu-emacs
On 2017-07-30, at 23:47, Emanuel Berg <moasen@zoho.com> wrote:
> Marcin Borkowski wrote:
>
>>>> Yes, it's not very long. But I wanted to do
>>>> it quickly without programming. Then,
>>>> what's the point of having keyboard macros?
>>>
>>> None whatsoever for people like you who know
>>> how to program.
>>
>> Speed.
>
> Not in the medium or long run as you get better
> with Elisp, and keyboard macros are much more
> difficult to adapt/debug.
>
> There is the ELPA and MELPA with readily
> transferable Elisp for a reason. But where do
> you guys get your keyboard macros?
> The port block?
A typical use case: I need to fix/edit/add something in a configuration
file, using the format VARIABLE=value, for 4-5 variables with similar
names (like PREFIX_SOMETHING=value, where value is somehow based on
SOMETHING). I record a keybord macro, press F4 3-4 times, bam, done, in
10 seconds. (Recently, I started to use multiple cursors for that kind
of stuff, too, but keyboard macros are a tad more powerful, I guess.)
> Learn to type really, really fast. Use Elisp
> whenever it isn't fast enough. Speed kills.
Typing fast would be fine, but keyboard macros don't make mistakes.
--
Marcin Borkowski
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: strange behaviour in keyboard macro
2017-07-31 4:40 ` Marcin Borkowski
@ 2017-07-31 9:19 ` Emanuel Berg
2017-08-09 6:18 ` Stefan Huchler
0 siblings, 1 reply; 10+ messages in thread
From: Emanuel Berg @ 2017-07-31 9:19 UTC (permalink / raw)
To: help-gnu-emacs
Marcin Borkowski wrote:
> A typical use case: I need to fix/edit/add
> something in a configuration file, using the
> format VARIABLE=value, for 4-5 variables with
> similar names (like PREFIX_SOMETHING=value,
> where value is somehow based on SOMETHING).
> I record a keybord macro, press F4 3-4 times,
> bam, done, in 10 seconds. (Recently,
> I started to use multiple cursors for that
> kind of stuff, too, but keyboard macros are
> a tad more powerful, I guess.)
4-5 variables?! :O
I think I'd do *40-50* with typing only before
I even considered anything else. And it takes
less time than drinking a 33 cl 2.8% beer.
Ba ba ba ba ba ba ba. Done.
For configuration files absolutely unnecessary
both keyboard macros and Elisp. Perhaps for
huge batch data files, but then I'd use some
shell processing tool to clean that up, rather.
Here, I say "Elisp" as in Elisp to do the
specific case. But Santa has a few helpers that
works in general, and can be applied to many
situations, e.g.:
http://user.it.uu.se/~embe8573/emacs-init/align.el
>> Learn to type really, really fast. Use Elisp
>> whenever it isn't fast enough. Speed kills.
>
> Typing fast would be fine, but keyboard
> macros don't make mistakes.
They do which is one of their problems.
Doing Elisp also has errors (bugs) but 1) they
are much easier to fix, and 2) the solution is
transferable and transformable. Keyboard macros
are poor-man's programming by definition.
Will be inferior, always. And they don't lead
anywhere. Elisp on the contrary leads to more
Elisp, to the destruction of many young men's
careers and so on. But what do you need
a career for when you have Elisp?
TEHO, of course.
--
underground experts united
http://user.it.uu.se/~embe8573
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: strange behaviour in keyboard macro
2017-07-31 9:19 ` Emanuel Berg
@ 2017-08-09 6:18 ` Stefan Huchler
0 siblings, 0 replies; 10+ messages in thread
From: Stefan Huchler @ 2017-08-09 6:18 UTC (permalink / raw)
To: help-gnu-emacs
Emanuel Berg <moasen@zoho.com> writes:
> Will be inferior, always. And they don't lead
> anywhere. Elisp on the contrary leads to more
> Elisp, to the destruction of many young men's
> careers and so on. But what do you need
> a career for when you have Elisp?
>
> TEHO, of course.
Ahh lol, so I am not the only one :D with no career :)
Well had none before I learned elisp, but I feel like elisp makes shure
that I never will have one :D
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2017-08-09 6:18 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-07-30 5:51 strange behaviour in keyboard macro Héctor Lahoz
2017-07-30 7:26 ` Emanuel Berg
2017-07-30 10:01 ` Héctor Lahoz
2017-07-30 13:46 ` Emanuel Berg
2017-07-30 20:19 ` Marcin Borkowski
2017-07-30 21:47 ` Emanuel Berg
2017-07-31 4:40 ` Marcin Borkowski
2017-07-31 9:19 ` Emanuel Berg
2017-08-09 6:18 ` Stefan Huchler
2017-07-30 13:50 ` Emanuel Berg
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).