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

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

Re: Tmux replacement or integration with Emacs.


From: Jean Louis
Subject: Re: Tmux replacement or integration with Emacs.
Date: Wed, 3 Feb 2021 10:13:59 +0300
User-agent: Mutt/2.0 (3d08634) (2020-11-07)

* Hongyi Zhao <hongyi.zhao@gmail.com> [2021-02-03 07:31]:
> > When I really wish to remember a file, I put it in the register or
> > bookmark. Like {C-x r j s} holds important file for me. I don't know
> > why I like "jump to register" sometimes more than a simple bookmark.
> >
> > Maybe because I learned how to set it:
> >
> > (set-register ?s '(file . "~/Documents/Org/my-file.org"))
> 
> What's the meaning of the `?' used above?

You may evaluate the below expression to find it in the manual:

(info "(elisp) Basic Char Syntax")

>From manual:

> 2.4.3.1 Basic Char Syntax
> .........................

> Since characters are really integers, the printed representation of a
> character is a decimal number.  This is also a possible read syntax for
> a character, but writing characters that way in Lisp programs is not
> clear programming.  You should _always_ use the special read syntax
> formats that Emacs Lisp provides for characters.  These syntax formats
> start with a question mark.

>    The usual read syntax for alphanumeric characters is a question mark
> followed by the character; thus, ‘?A’ for the character ‘A’, ‘?B’ for
> the character ‘B’, and ‘?a’ for the character ‘a’.

>    For example:

>      ?Q ⇒ 81     ?q ⇒ 113

> > I even have some other hard to decipher settings to jump to register:
> >
> > (set-register ?S #s(kmacro-register [134217848 115 104 101 108 108 
> > return]))     ;; M-x shell
> > (set-register ?e #s(kmacro-register [134217848 101 115 104 101 108 108 
> > return])) ;; M-x eshell
> > (set-register ?p #s(kmacro-register [134217848 115 113 108 45 112 111 115 
> > tab return])) ;; sql-postgres
> 
> Really obscure for me to understand. Any more hints/notes for the
> meaning of them?

That is definitely obscure, even to me who made those settings.

It is macro that is stored in register. To define macro you can use F3
then perform some actions and save macro with F4.

It is then invoked by using {C-x r j S} for register `S' and {C-x r j e}
for register `e' and so on.

By using the command {M-x insert-kbd-macro RET} you would then get
this kind of the output in the buffer:

(setq last-kbd-macro
   [?\M-x ?e ?s ?h ?e ?l ?l return])

And then you could replace those above characters in the init.el file
to this below:

(set-register ?e #s(kmacro-register [134217848 ?e ?s ?h ?e ?l ?l return]))

Then I invoke it with {C-x r j e} to get to eshell.

Yes, that is all complicated and not user friendly. It is however in
my muscle memory and that is how I get faster to some buffers.

Jean




reply via email to

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