unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Tmux replacement or integration with Emacs.
@ 2021-02-01  4:16 Hongyi Zhao
  2021-02-01  4:38 ` Stefan Monnier
  2021-02-01 16:24 ` Husain Alshehhi
  0 siblings, 2 replies; 18+ messages in thread
From: Hongyi Zhao @ 2021-02-01  4:16 UTC (permalink / raw)
  To: help-gnu-emacs

In Emacs, can I obtain the same/more capabilities supplied by tmux?
Should I  replace tmux with appropriate Emacs packages - if existent -
or integrate it with Emacs?

Regards
-- 
Assoc. Prof. Hongyi Zhao <hongyi.zhao@gmail.com>
Theory and Simulation of Materials
Hebei Polytechnic University of Science and Technology engineering
NO. 552 North Gangtie Road, Xingtai, China



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

* Re: Tmux replacement or integration with Emacs.
  2021-02-01  4:16 Tmux replacement or integration with Emacs Hongyi Zhao
@ 2021-02-01  4:38 ` Stefan Monnier
  2021-02-01  5:22   ` moasenwood--- via Users list for the GNU Emacs text editor
  2021-02-01 16:24 ` Husain Alshehhi
  1 sibling, 1 reply; 18+ messages in thread
From: Stefan Monnier @ 2021-02-01  4:38 UTC (permalink / raw)
  To: help-gnu-emacs

> In Emacs, can I obtain the same/more capabilities supplied by tmux?

I don't think Tmux comes with anything comparable to `M-x doctor`, so
clearly you can obtain *more* with Emacs than with Tmux.


        Stefan




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

* Re: Tmux replacement or integration with Emacs.
  2021-02-01  4:38 ` Stefan Monnier
@ 2021-02-01  5:22   ` moasenwood--- via Users list for the GNU Emacs text editor
  2021-02-01 16:24     ` Jean Louis
  0 siblings, 1 reply; 18+ messages in thread
From: moasenwood--- via Users list for the GNU Emacs text editor @ 2021-02-01  5:22 UTC (permalink / raw)
  To: help-gnu-emacs

Stefan Monnier wrote:

>> In Emacs, can I obtain the same/more capabilities supplied
>> by tmux?
>
> I don't think Tmux comes with anything comparable to `M-x
> doctor`, so clearly you can obtain *more* with Emacs than
> with Tmux.

No doubt, as tmux is a terminal multiplexer and Emacs is an,
uhm, text editor. tmux is still great to have around. It feels
like everyone uses tmux these days. And so do I.

-- 
underground experts united
http://user.it.uu.se/~embe8573
https://dataswamp.org/~incal




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

* Re: Tmux replacement or integration with Emacs.
  2021-02-01  4:16 Tmux replacement or integration with Emacs Hongyi Zhao
  2021-02-01  4:38 ` Stefan Monnier
@ 2021-02-01 16:24 ` Husain Alshehhi
  2021-02-02  3:56   ` moasenwood--- via Users list for the GNU Emacs text editor
  1 sibling, 1 reply; 18+ messages in thread
From: Husain Alshehhi @ 2021-02-01 16:24 UTC (permalink / raw)
  To: help-gnu-emacs


Hongyi Zhao writes:

> In Emacs, can I obtain the same/more capabilities supplied by 
> tmux?
> Should I  replace tmux with appropriate Emacs packages - if 
> existent -
> or integrate it with Emacs?


Well, that depends on what you use tmux for. I use tmux sometimes 
for starting long running jobs on a remote server that does not 
have emacs for example. I don't use it on my machine as I run 
multiple shells in emacs instead.



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

* Re: Tmux replacement or integration with Emacs.
  2021-02-01  5:22   ` moasenwood--- via Users list for the GNU Emacs text editor
@ 2021-02-01 16:24     ` Jean Louis
  2021-02-01 16:43       ` moasenwood--- via Users list for the GNU Emacs text editor
  2021-02-01 16:49       ` moasenwood--- via Users list for the GNU Emacs text editor
  0 siblings, 2 replies; 18+ messages in thread
From: Jean Louis @ 2021-02-01 16:24 UTC (permalink / raw)
  To: help-gnu-emacs

* moasenwood--- via Users list for the GNU Emacs text editor <help-gnu-emacs@gnu.org> [2021-02-01 08:23]:
> Stefan Monnier wrote:
> 
> >> In Emacs, can I obtain the same/more capabilities supplied
> >> by tmux?
> >
> > I don't think Tmux comes with anything comparable to `M-x
> > doctor`, so clearly you can obtain *more* with Emacs than
> > with Tmux.
> 
> No doubt, as tmux is a terminal multiplexer and Emacs is an,
> uhm, text editor. tmux is still great to have around. It feels
> like everyone uses tmux these days. And so do I.

Emacs is replaceable with `screen' and `tmux' in the functional
sense. Maybe Emacs does not have best terminal emulation, but
practically users can run multiple shell sessions and Terminal
within one Emacs daemon, they may sign off and log in again with
sessions remaining intact.

Sometimes I was running screen with multiple shell sessions, sometimes
running multiple Emacs instances, sometimes Emacs in similar fashion
as screen or tmux runnning multiple shell sessions.



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

* Re: Tmux replacement or integration with Emacs.
  2021-02-01 16:24     ` Jean Louis
@ 2021-02-01 16:43       ` moasenwood--- via Users list for the GNU Emacs text editor
  2021-02-03  4:09         ` Jean Louis
  2021-02-01 16:49       ` moasenwood--- via Users list for the GNU Emacs text editor
  1 sibling, 1 reply; 18+ messages in thread
From: moasenwood--- via Users list for the GNU Emacs text editor @ 2021-02-01 16:43 UTC (permalink / raw)
  To: help-gnu-emacs

Jean Louis wrote:

>> No doubt, as tmux is a terminal multiplexer and Emacs is an,
>> uhm, text editor. tmux is still great to have around. It feels
>> like everyone uses tmux these days. And so do I.
>
> Emacs is replaceable with `screen' and `tmux' in the
> functional sense. Maybe Emacs does not have best terminal
> emulation, but practically users can run multiple shell
> sessions and Terminal within one Emacs daemon, they may sign
> off and log in again with sessions remaining intact.

Yeah, but do you manage to navigate between them in a way that
don't get too complicated and you end up like lost in Emacs?

I have Emacs in the Linux VT /dev/tty1, then 2 panes of tmux
to the left (M-l), i.e. ttys2-3, then tty3 is 1 pane of tmux,
then tty4 is just the bare Linux VT, then X is rightmost with
2 panes of tmux in xterm.

M-j go left, M-l go right

M-e - go to Emacs, good shortcut in many ways BTW :))

M-u - got to X

Linux VT keys:

  https://dataswamp.org/~incal/conf/vt/remap.inc

Ditto X:

  https://dataswamp.org/~incal/conf/.cwmrc
  (a nice WM, for this it invokes chvt(1) which has 'chmod +s'
   AKA the sticky bit)

-- 
underground experts united
http://user.it.uu.se/~embe8573
https://dataswamp.org/~incal




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

* Re: Tmux replacement or integration with Emacs.
  2021-02-01 16:24     ` Jean Louis
  2021-02-01 16:43       ` moasenwood--- via Users list for the GNU Emacs text editor
@ 2021-02-01 16:49       ` moasenwood--- via Users list for the GNU Emacs text editor
  2021-02-02  2:31         ` Hongyi Zhao
  1 sibling, 1 reply; 18+ messages in thread
From: moasenwood--- via Users list for the GNU Emacs text editor @ 2021-02-01 16:49 UTC (permalink / raw)
  To: help-gnu-emacs

Jean Louis wrote:

> Emacs is replaceable with `screen' and `tmux' in the
> functional sense. Maybe Emacs does not have best terminal
> emulation, but practically users can run multiple shell
> sessions and Terminal within one Emacs daemon, they may sign
> off and log in again with sessions remaining intact.
>
> Sometimes I was running screen with multiple shell sessions,
> sometimes running multiple Emacs instances, sometimes Emacs
> in similar fashion as screen or tmux runnning multiple
> shell sessions.

BTW I know a book for you :)

@book{tmux,
  author     = {Brian P Hogan},
  isbn       = {978-1-93435-696-8},
  publisher  = {Brian P Hogan},
  title      = {tmux: Productive Mouse-Free Development},
  year       = {2012}
}

-- 
underground experts united
http://user.it.uu.se/~embe8573
https://dataswamp.org/~incal




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

* Re: Tmux replacement or integration with Emacs.
  2021-02-01 16:49       ` moasenwood--- via Users list for the GNU Emacs text editor
@ 2021-02-02  2:31         ` Hongyi Zhao
  2021-02-02  3:17           ` Stefan Monnier
  2021-02-02  4:00           ` moasenwood--- via Users list for the GNU Emacs text editor
  0 siblings, 2 replies; 18+ messages in thread
From: Hongyi Zhao @ 2021-02-02  2:31 UTC (permalink / raw)
  To: Emanuel Berg, help-gnu-emacs

On Tue, Feb 2, 2021 at 12:50 AM moasenwood--- via Users list for the
GNU Emacs text editor <help-gnu-emacs@gnu.org> wrote:
>
> Jean Louis wrote:
>
> > Emacs is replaceable with `screen' and `tmux' in the
> > functional sense. Maybe Emacs does not have best terminal
> > emulation, but practically users can run multiple shell
> > sessions and Terminal within one Emacs daemon, they may sign
> > off and log in again with sessions remaining intact.
> >
> > Sometimes I was running screen with multiple shell sessions,
> > sometimes running multiple Emacs instances, sometimes Emacs
> > in similar fashion as screen or tmux runnning multiple
> > shell sessions.
>
> BTW I know a book for you :)
>
> @book{tmux,
>   author     = {Brian P Hogan},
>   isbn       = {978-1-93435-696-8},
>   publisher  = {Brian P Hogan},
>   title      = {tmux: Productive Mouse-Free Development},

So, I ask the following question:

Mouse-Free Development, Emacs vs tmux, which is more productive?

>   year       = {2012}
> }
>
> --
> underground experts united
> http://user.it.uu.se/~embe8573
> https://dataswamp.org/~incal
>
>


-- 
Assoc. Prof. Hongyi Zhao <hongyi.zhao@gmail.com>
Theory and Simulation of Materials
Hebei Polytechnic University of Science and Technology engineering
NO. 552 North Gangtie Road, Xingtai, China



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

* Re: Tmux replacement or integration with Emacs.
  2021-02-02  2:31         ` Hongyi Zhao
@ 2021-02-02  3:17           ` Stefan Monnier
  2021-02-02  4:02             ` moasenwood--- via Users list for the GNU Emacs text editor
  2021-02-02  4:00           ` moasenwood--- via Users list for the GNU Emacs text editor
  1 sibling, 1 reply; 18+ messages in thread
From: Stefan Monnier @ 2021-02-02  3:17 UTC (permalink / raw)
  To: help-gnu-emacs

> Mouse-Free Development, Emacs vs tmux, which is more productive?

Why choose?
You can definitely run Emacs inside Tmux, and I suspect you can also run
Tmux inside Emacs,


        Stefan




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

* Re: Tmux replacement or integration with Emacs.
  2021-02-01 16:24 ` Husain Alshehhi
@ 2021-02-02  3:56   ` moasenwood--- via Users list for the GNU Emacs text editor
  0 siblings, 0 replies; 18+ messages in thread
From: moasenwood--- via Users list for the GNU Emacs text editor @ 2021-02-02  3:56 UTC (permalink / raw)
  To: help-gnu-emacs

Husain Alshehhi wrote:

>> In Emacs, can I obtain the same/more capabilities supplied
>> by tmux? Should I replace tmux with appropriate Emacs
>> packages - if existent - or integrate it with Emacs?
>
> Well, that depends on what you use tmux for. I use tmux
> sometimes for starting long running jobs on a remote server
> that does not have emacs for example. I don't use it on my
> machine as I run multiple shells in emacs instead.

OK, but you can use Emacs on remote servers as well, with
tramp for example.

-- 
underground experts united
http://user.it.uu.se/~embe8573
https://dataswamp.org/~incal




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

* Re: Tmux replacement or integration with Emacs.
  2021-02-02  2:31         ` Hongyi Zhao
  2021-02-02  3:17           ` Stefan Monnier
@ 2021-02-02  4:00           ` moasenwood--- via Users list for the GNU Emacs text editor
  1 sibling, 0 replies; 18+ messages in thread
From: moasenwood--- via Users list for the GNU Emacs text editor @ 2021-02-02  4:00 UTC (permalink / raw)
  To: help-gnu-emacs

Hongyi Zhao wrote:

> So, I ask the following question:
>
> Mouse-Free Development, Emacs vs tmux, which is
> more productive?

Emacs is a text editor but also a web browser (Emacs-w3m), an
IRC client (ERC), a mail/NNTP client (Gnus), and much,
much more.

tmux is a terminal multiplexer.

So Emacs is much more versatile and powerful, however, as for
productiveness, maybe some people would say with Emacs you are
just doing pleasant things all day long instead of being
productive :)

-- 
underground experts united
http://user.it.uu.se/~embe8573
https://dataswamp.org/~incal




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

* Re: Tmux replacement or integration with Emacs.
  2021-02-02  3:17           ` Stefan Monnier
@ 2021-02-02  4:02             ` moasenwood--- via Users list for the GNU Emacs text editor
  0 siblings, 0 replies; 18+ messages in thread
From: moasenwood--- via Users list for the GNU Emacs text editor @ 2021-02-02  4:02 UTC (permalink / raw)
  To: help-gnu-emacs

Stefan Monnier wrote:

>> Mouse-Free Development, Emacs vs tmux, which is
>> more productive?
>
> Why choose? You can definitely run Emacs inside Tmux, and
> I suspect you can also run Tmux inside Emacs,

You can, in vterm for example.

-- 
underground experts united
http://user.it.uu.se/~embe8573
https://dataswamp.org/~incal




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

* Re: Tmux replacement or integration with Emacs.
  2021-02-01 16:43       ` moasenwood--- via Users list for the GNU Emacs text editor
@ 2021-02-03  4:09         ` Jean Louis
  2021-02-03  4:30           ` Hongyi Zhao
  2021-02-05  8:10           ` Emanuel Berg via Users list for the GNU Emacs text editor
  0 siblings, 2 replies; 18+ messages in thread
From: Jean Louis @ 2021-02-03  4:09 UTC (permalink / raw)
  To: help-gnu-emacs

* moasenwood--- via Users list for the GNU Emacs text editor <help-gnu-emacs@gnu.org> [2021-02-01 19:44]:
> Jean Louis wrote:
> 
> >> No doubt, as tmux is a terminal multiplexer and Emacs is an,
> >> uhm, text editor. tmux is still great to have around. It feels
> >> like everyone uses tmux these days. And so do I.
> >
> > Emacs is replaceable with `screen' and `tmux' in the
> > functional sense. Maybe Emacs does not have best terminal
> > emulation, but practically users can run multiple shell
> > sessions and Terminal within one Emacs daemon, they may sign
> > off and log in again with sessions remaining intact.
> 
> Yeah, but do you manage to navigate between them in a way that
> don't get too complicated and you end up like lost in Emacs?

I switch to buffers to avoid end up being lost. It may be that same
operation causes the feeling of being lost. But I got used to it.

In Emacs X Window Manager EXWM I will often use workspace 1 for email,
3 for Internet browser, maybe 5 for graphics, shell is on workspace 9
and so on. In `screen' I will also sometimes designate screen numbers
and remember them by its operation.

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"))

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

Of course when use learns few needed buffers and key bindings that is
how one does not get lost.

Jean



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

* Re: Tmux replacement or integration with Emacs.
  2021-02-03  4:09         ` Jean Louis
@ 2021-02-03  4:30           ` Hongyi Zhao
  2021-02-03  7:13             ` Jean Louis
  2021-02-03  7:19             ` moasenwood--- via Users list for the GNU Emacs text editor
  2021-02-05  8:10           ` Emanuel Berg via Users list for the GNU Emacs text editor
  1 sibling, 2 replies; 18+ messages in thread
From: Hongyi Zhao @ 2021-02-03  4:30 UTC (permalink / raw)
  To: help-gnu-emacs

On Wed, Feb 3, 2021 at 12:13 PM Jean Louis <bugs@gnu.support> wrote:
>
> * moasenwood--- via Users list for the GNU Emacs text editor <help-gnu-emacs@gnu.org> [2021-02-01 19:44]:
> > Jean Louis wrote:
> >
> > >> No doubt, as tmux is a terminal multiplexer and Emacs is an,
> > >> uhm, text editor. tmux is still great to have around. It feels
> > >> like everyone uses tmux these days. And so do I.
> > >
> > > Emacs is replaceable with `screen' and `tmux' in the
> > > functional sense. Maybe Emacs does not have best terminal
> > > emulation, but practically users can run multiple shell
> > > sessions and Terminal within one Emacs daemon, they may sign
> > > off and log in again with sessions remaining intact.
> >
> > Yeah, but do you manage to navigate between them in a way that
> > don't get too complicated and you end up like lost in Emacs?
>
> I switch to buffers to avoid end up being lost. It may be that same
> operation causes the feeling of being lost. But I got used to it.
>
> In Emacs X Window Manager EXWM I will often use workspace 1 for email,
> 3 for Internet browser, maybe 5 for graphics, shell is on workspace 9
> and so on. In `screen' I will also sometimes designate screen numbers
> and remember them by its operation.
>
> 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?

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

Regards,
HY

> Of course when use learns few needed buffers and key bindings that is
> how one does not get lost.
>
> Jean
>


-- 
Assoc. Prof. Hongyi Zhao <hongyi.zhao@gmail.com>
Theory and Simulation of Materials
Hebei Polytechnic University of Science and Technology engineering
NO. 552 North Gangtie Road, Xingtai, China



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

* Re: Tmux replacement or integration with Emacs.
  2021-02-03  4:30           ` Hongyi Zhao
@ 2021-02-03  7:13             ` Jean Louis
  2021-02-03  7:32               ` moasenwood--- via Users list for the GNU Emacs text editor
  2021-02-03  7:19             ` moasenwood--- via Users list for the GNU Emacs text editor
  1 sibling, 1 reply; 18+ messages in thread
From: Jean Louis @ 2021-02-03  7:13 UTC (permalink / raw)
  To: help-gnu-emacs

* 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




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

* Re: Tmux replacement or integration with Emacs.
  2021-02-03  4:30           ` Hongyi Zhao
  2021-02-03  7:13             ` Jean Louis
@ 2021-02-03  7:19             ` moasenwood--- via Users list for the GNU Emacs text editor
  1 sibling, 0 replies; 18+ messages in thread
From: moasenwood--- via Users list for the GNU Emacs text editor @ 2021-02-03  7:19 UTC (permalink / raw)
  To: help-gnu-emacs

Hongyi Zhao wrote:

>> (set-register ?s '(file . "~/Documents/Org/my-file.org"))
>
> What's the meaning of the `?' used above?

It is the Emacs notation for a character, or char (pronounced
"kar")

So eval this to get one of my favorite chars OAT, the
letter p!

  ?p
    ^ here :)

-- 
underground experts united
http://user.it.uu.se/~embe8573
https://dataswamp.org/~incal




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

* Re: Tmux replacement or integration with Emacs.
  2021-02-03  7:13             ` Jean Louis
@ 2021-02-03  7:32               ` moasenwood--- via Users list for the GNU Emacs text editor
  0 siblings, 0 replies; 18+ messages in thread
From: moasenwood--- via Users list for the GNU Emacs text editor @ 2021-02-03  7:32 UTC (permalink / raw)
  To: help-gnu-emacs

Jean Louis wrote:

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

So that's the way one is supposed to do it. I wrote this, it
works just the same way [last]

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

It gets SOO much faster!

;;; -*- lexical-binding: t -*-
;;;
;;; this file:
;;;   http://user.it.uu.se/~embe8573/emacs-init/navigate-fs-keys.el
;;;   https://dataswamp.org/~incal/emacs-init/navigate-fs-keys.el

(require 'cl-lib)
(require 'count)
(require 'files-my)
(require 'netrc)
(require 'nnmail)
(require 'sudo-user-path)
(require 'super)
(require 'w3m-bookmark)

(defun do-show-file (file)
  (interactive "ffile: ")
  (let ((this-buffer   (current-buffer))
        (target-buffer (find-file-noselect file) ))
    (if (eq this-buffer target-buffer)
        (message "already here")
      (find-file file)
      (unless (buffer-modified-p)
        (revert-buffer t t nil)) )))

(defun shortcut-to-file (key-prefix key file &optional file-prefix)
  "Make shortcut with key KEY-PREFIX KEY to FILE-PREFIX FILE."
  (let*((key (format "%s%s" key-prefix key))
                (file-dir (or file-prefix "~"))
                (file     (expand-file-name file file-dir)))
    (global-set-key key
                    (lambda () (interactive) (do-show-file file)) )))

(define-prefix-command        'C-j-prefix-name)
(super-global-set-key  "\C-j" 'C-j-prefix-name)

(defun shortcut-to-function (key-prefix key function)
  (global-set-key (format "%s%s" key-prefix key) function) )

(defun set-keys (ks &optional key path)
  (let ((key      (format "%s%s" (or key  "") (car  ks)))
        (the-path (format "%s%s" (or path "") (cadr ks)))
        (kps (cl-caddr ks)))
    (dolist (kp kps)
      (if (= 2 (length kp))
          (if (functionp (cadr kp))
              (shortcut-to-function key (car kp) (cadr kp))
            (shortcut-to-file key (car kp) (cadr kp) the-path) )
        (set-keys kp key the-path) ))))

(set-keys
 `("\C-j" ; invoke key
   "~/"   ; base path
   (
    ;; SYNTAX: ("key" "absolute path") - OK
    ;;         ("key" "relative path") - OK
    ;;         ("key" function)        - interactive lambda only
    ;;         ("key" ,variable)       - first `require'
    ;;
    ;;  NOTES: * keys are case sensitive but A is a when A is
    ;;           unset
    ;;         * path syntax works: e.g., ~ and /sudo:user@host:/path
    ;;           (for sudo, see `sudo-user-path')
    ;;         * can be nested - hint: make it mnemonic
    ;;           especially for non-everyday shortcuts. e.g.,
    ;;           C-j e w k -> (e)macs (w)3m (k)eys
    ;;                     -> ~/.emacs.d/emacs-init/w3m/w3m-keys.el
    ("." (lambda () (interactive) (dired-jump)))
    ("A" ,(sudo-root-path "/etc/apt/sources.list"))
    ("a" "public_html/GEAR")
    ("b" "public_html/books/" (
                               ("." ".")
                               ("b" "books.bib")
                               ("l" "books.tex")
                               ("m" "Makefile")
                               ))
    ;; etc
    )))

-- 
underground experts united
http://user.it.uu.se/~embe8573
https://dataswamp.org/~incal




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

* Re: Tmux replacement or integration with Emacs.
  2021-02-03  4:09         ` Jean Louis
  2021-02-03  4:30           ` Hongyi Zhao
@ 2021-02-05  8:10           ` Emanuel Berg via Users list for the GNU Emacs text editor
  1 sibling, 0 replies; 18+ messages in thread
From: Emanuel Berg via Users list for the GNU Emacs text editor @ 2021-02-05  8:10 UTC (permalink / raw)
  To: help-gnu-emacs

Jean Louis wrote:

> I switch to buffers to avoid end up being lost. It may be
> that same operation causes the feeling of being lost.
> But I got used to it.
>
> In Emacs X Window Manager EXWM I will often use workspace 1
> for email, 3 for Internet browser, maybe 5 for graphics,
> shell is on workspace 9 and so on. In `screen' I will also
> sometimes designate screen numbers and remember them by
> its operation.
>
> 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. [...]

Okay, it is the same style. We just use different methods

I don't get lost but sometimes I need to reset - where I'm
going, right now? and _think_, before I type again.

Sometimes when I'm tired I forget what I'm doing and the
buffers displayed, looking at them, I can think of several
things I could have been doing the last couple of seconds...
if I continue then, it'll just happen more and more frequently
until it is absolutely impossible to do anything. But you are
just too tired to do anything, including stop doing
something...

-- 
underground experts united
http://user.it.uu.se/~embe8573
https://dataswamp.org/~incal




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

end of thread, other threads:[~2021-02-05  8:10 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-02-01  4:16 Tmux replacement or integration with Emacs Hongyi Zhao
2021-02-01  4:38 ` Stefan Monnier
2021-02-01  5:22   ` moasenwood--- via Users list for the GNU Emacs text editor
2021-02-01 16:24     ` Jean Louis
2021-02-01 16:43       ` moasenwood--- via Users list for the GNU Emacs text editor
2021-02-03  4:09         ` Jean Louis
2021-02-03  4:30           ` Hongyi Zhao
2021-02-03  7:13             ` Jean Louis
2021-02-03  7:32               ` moasenwood--- via Users list for the GNU Emacs text editor
2021-02-03  7:19             ` moasenwood--- via Users list for the GNU Emacs text editor
2021-02-05  8:10           ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-02-01 16:49       ` moasenwood--- via Users list for the GNU Emacs text editor
2021-02-02  2:31         ` Hongyi Zhao
2021-02-02  3:17           ` Stefan Monnier
2021-02-02  4:02             ` moasenwood--- via Users list for the GNU Emacs text editor
2021-02-02  4:00           ` moasenwood--- via Users list for the GNU Emacs text editor
2021-02-01 16:24 ` Husain Alshehhi
2021-02-02  3:56   ` moasenwood--- via Users list for the GNU Emacs text editor

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