all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Frame numbering
@ 2014-04-18 21:34 Joshua Studen
  2014-04-19  1:07 ` Drew Adams
  2014-04-19  6:32 ` Eli Zaretskii
  0 siblings, 2 replies; 9+ messages in thread
From: Joshua Studen @ 2014-04-18 21:34 UTC (permalink / raw)
  To: help-gnu-emacs

Hi,

Is there an easy way to have numbered frames in Emacs? I guess, I'd like to
setup my environment similar to what screen/tmux offer. I've found
elscreen, but after using it for a while, I find it more of a distraction
rather than an aid.

Like with Tmux or screen, I can do C-b (or C-a) and then a number and it
will switch to that screen/tmux pane. I think it COULD be possible with
Emacs, but I don't know how to do it.

Any advice or suggestions?

Thanks!
Josh


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

* RE: Frame numbering
  2014-04-18 21:34 Frame numbering Joshua Studen
@ 2014-04-19  1:07 ` Drew Adams
  2014-04-19 14:39   ` Joshua Studen
       [not found]   ` <mailman.19880.1397918343.10748.help-gnu-emacs@gnu.org>
  2014-04-19  6:32 ` Eli Zaretskii
  1 sibling, 2 replies; 9+ messages in thread
From: Drew Adams @ 2014-04-19  1:07 UTC (permalink / raw)
  To: Joshua Studen, help-gnu-emacs

> Is there an easy way to have numbered frames in Emacs? I guess, I'd like to
> setup my environment similar to what screen/tmux offer. I've found
> elscreen, but after using it for a while, I find it more of a distraction
> rather than an aid.
> 
> Like with Tmux or screen, I can do C-b (or C-a) and then a number and it
> will switch to that screen/tmux pane. I think it COULD be possible with
> Emacs, but I don't know how to do it.
> 
> Any advice or suggestions?

This might be some help, though it does not seem to be exactly what you
are requesting.

1. `C-x 5 o' cycles among the available frames.  This is true even if you
use Emacs in a terminal (i.e., without a graphic display) - see the Emacs
manual, node `Non-Window Terminals'.

2. Command `select-frame-by-name' raises and selects a frame by name,
providing completion.  Again, this works also without a graphic display.
Frame names in a terminal are simple by default: FN1, FN2, etc.
Bind the command to a key, e.g., `C-a' as you suggested.  Then
`C-a TAB 3' takes you to frame FN3.



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

* Re: Frame numbering
  2014-04-18 21:34 Frame numbering Joshua Studen
  2014-04-19  1:07 ` Drew Adams
@ 2014-04-19  6:32 ` Eli Zaretskii
  2014-04-19  8:17   ` Alan Schmitt
  1 sibling, 1 reply; 9+ messages in thread
From: Eli Zaretskii @ 2014-04-19  6:32 UTC (permalink / raw)
  To: help-gnu-emacs

> Date: Fri, 18 Apr 2014 17:34:55 -0400
> From: Joshua Studen <joshua.studen@gmail.com>
> 
> Is there an easy way to have numbered frames in Emacs?

You don't say whether this is on a TTY or in GUI sessions.  On a TTY,
Emacs already numbers the frames: they are called F1, F2, F3, etc.



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

* Re: Frame numbering
  2014-04-19  6:32 ` Eli Zaretskii
@ 2014-04-19  8:17   ` Alan Schmitt
  2014-04-19  8:42     ` Eli Zaretskii
  0 siblings, 1 reply; 9+ messages in thread
From: Alan Schmitt @ 2014-04-19  8:17 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: help-gnu-emacs

On 2014-04-19 08:32, Eli Zaretskii <eliz@gnu.org> writes:

>> Date: Fri, 18 Apr 2014 17:34:55 -0400
>> From: Joshua Studen <joshua.studen@gmail.com>
>> 
>> Is there an easy way to have numbered frames in Emacs?
>
> You don't say whether this is on a TTY or in GUI sessions.  On a TTY,
> Emacs already numbers the frames: they are called F1, F2, F3, etc.

Is it possible in a GUI emacs to have stable frame names? I just gave
this a try and the name of the frame seems to be the name of the focused
buffer.

Thanks,

Alan



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

* Re: Frame numbering
  2014-04-19  8:17   ` Alan Schmitt
@ 2014-04-19  8:42     ` Eli Zaretskii
  2014-04-19 11:00       ` Alan Schmitt
  0 siblings, 1 reply; 9+ messages in thread
From: Eli Zaretskii @ 2014-04-19  8:42 UTC (permalink / raw)
  To: help-gnu-emacs

> From: Alan Schmitt <alan.schmitt@polytechnique.org>
> Cc: help-gnu-emacs@gnu.org
> Date: Sat, 19 Apr 2014 10:17:12 +0200
> 
> Is it possible in a GUI emacs to have stable frame names? I just gave
> this a try and the name of the frame seems to be the name of the focused
> buffer.

I think you want "M-x set-frame-name RET".



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

* Re: Frame numbering
  2014-04-19  8:42     ` Eli Zaretskii
@ 2014-04-19 11:00       ` Alan Schmitt
  0 siblings, 0 replies; 9+ messages in thread
From: Alan Schmitt @ 2014-04-19 11:00 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: help-gnu-emacs

On 2014-04-19 10:42, Eli Zaretskii <eliz@gnu.org> writes:

>> From: Alan Schmitt <alan.schmitt@polytechnique.org>
>> Cc: help-gnu-emacs@gnu.org
>> Date: Sat, 19 Apr 2014 10:17:12 +0200
>> 
>> Is it possible in a GUI emacs to have stable frame names? I just gave
>> this a try and the name of the frame seems to be the name of the focused
>> buffer.
>
> I think you want "M-x set-frame-name RET".

Thanks a lot. In retrospect, this was very obvious, and I should have
first tried it.

Best,

Alan



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

* Re: Frame numbering
  2014-04-19  1:07 ` Drew Adams
@ 2014-04-19 14:39   ` Joshua Studen
  2014-04-19 19:42     ` Drew Adams
       [not found]   ` <mailman.19880.1397918343.10748.help-gnu-emacs@gnu.org>
  1 sibling, 1 reply; 9+ messages in thread
From: Joshua Studen @ 2014-04-19 14:39 UTC (permalink / raw)
  To: Drew Adams; +Cc: help-gnu-emacs

Number 1 is what I do now, it's just a lot a bit of a slow-down to have to
do it multiple times if I have multiple frames.

#2 is very close. The ONLY issue is that I use emacs both via GUI locally
and on a remote machine, I do emacs --daemon.  When I leave the remote
session, and come back and create a new Emacs client, the frame numbers do
NOT start back at F1,

I need a combination of your #2 and the suggested M-x set-frame-name. Maybe
next emacs, there will be a way to set a frame name :).

Thanks, all.


On Fri, Apr 18, 2014 at 9:07 PM, Drew Adams <drew.adams@oracle.com> wrote:

> > Is there an easy way to have numbered frames in Emacs? I guess, I'd like
> to
> > setup my environment similar to what screen/tmux offer. I've found
> > elscreen, but after using it for a while, I find it more of a distraction
> > rather than an aid.
> >
> > Like with Tmux or screen, I can do C-b (or C-a) and then a number and it
> > will switch to that screen/tmux pane. I think it COULD be possible with
> > Emacs, but I don't know how to do it.
> >
> > Any advice or suggestions?
>
> This might be some help, though it does not seem to be exactly what you
> are requesting.
>
> 1. `C-x 5 o' cycles among the available frames.  This is true even if you
> use Emacs in a terminal (i.e., without a graphic display) - see the Emacs
> manual, node `Non-Window Terminals'.
>
> 2. Command `select-frame-by-name' raises and selects a frame by name,
> providing completion.  Again, this works also without a graphic display.
> Frame names in a terminal are simple by default: FN1, FN2, etc.
> Bind the command to a key, e.g., `C-a' as you suggested.  Then
> `C-a TAB 3' takes you to frame FN3.
>


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

* RE: Frame numbering
  2014-04-19 14:39   ` Joshua Studen
@ 2014-04-19 19:42     ` Drew Adams
  0 siblings, 0 replies; 9+ messages in thread
From: Drew Adams @ 2014-04-19 19:42 UTC (permalink / raw)
  To: Joshua Studen; +Cc: help-gnu-emacs

>> 1. `C-x 5 o' cycles among the available frames.  This is true even
>> if you use Emacs in a terminal (i.e., without a graphic display) -
>> see the Emacs manual, node `Non-Window Terminals'.
>> 
>> 2. Command `select-frame-by-name' raises and selects a frame by name,
>> providing completion.  Again, this works also without a graphic display.
>> Frame names in a terminal are simple by default: FN1, FN2, etc.
>> Bind the command to a key, e.g., `C-a' as you suggested.  Then
>> `C-a TAB 3' takes you to frame FN3.
>
> Number 1 is what I do now, it's just a lot a bit of a slow-down to
> have to do it multiple times if I have multiple frames.
> 
> #2 is very close. The ONLY issue is that I use emacs both via GUI
> locally and on a remote machine, I do emacs --daemon.  When I leave
> the remote session, and come back and create a new Emacs client,
> the frame numbers do NOT start back at F1, I need a combination of
> your #2 and the suggested M-x set-frame-name. Maybe next emacs,
> there will be a way to set a frame name :).

FWIW, here is some code that will give you numeric frame names.
Together with binding `select-frame-by-name' to a convenient key
it should give you much of what you want.

You can add `name-frame-numerically' to a hook, such as
`after-make-frame-functions', or put it on an idle timer, or whatever.

If the selected name does not have a numeric name (1,2,3...) then
`name-frame-numerically' renames it and any other frames with
non-numeric names.  Else it does nothing (including not renaming any
other frames).

(require 'cl-lib)

(defun frame-number (frame)
  "Return FRAME's number, or nil if its name is not a numeral 1,2,3..."
  (let ((num  (string-to-number (frame-parameter frame 'name))))
    (and (wholenump num)  (not (zerop num))  num)))

(defun name-frame-numerically (&optional frame frames)
  "Name FRAME (default, selected frame) to a numeral in 1,2,3...
If FRAME's name is already such a numeral, do nothing.
Else:
 Rename it to a numeral one greater than the max numeric frame name.
 Rename any other frames to numerals also."
  (interactive)
  (setq frame   (or frame   (selected-frame))
        frames  (or frames  (list frame)))
  (let ((onum  (frame-number frame))
        onums max)
    (unless onum
      (dolist (fr  (cl-set-difference (frame-list) frames))
        (unless (eq fr frame)
          (name-frame-numerically fr (cons fr frames))))
      (setq onums  (delq nil (mapcar #'frame-number (frame-list)))
            max    (if onums (apply #'max onums) 0))
      (modify-frame-parameters
       frame `((name ,@(number-to-string (1+ max))))))))

;; Just in case you want such a command.
(defun name-all-frames-numerically (&optional startover)
  "Rename all frames to numerals in 1,2,3...
With optional arg STARTOVER (prefix arg, interactively), rename all
starting over from 1.  Otherwise, numbering continues from the highest
existing frame number."
  (interactive "P")
  (when startover
    (dolist (fr  (frame-list))
      (modify-frame-parameters
       fr `((name ,@(format "a%s" (frame-parameter fr 'name)))))))
  (mapc #'name-frame-numerically (frame-list)))

;; Name frames when they are created.
;; (add-hook 'after-make-frame-functions 'name-frame-numerically)



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

* Re: Frame numbering
       [not found]   ` <mailman.19880.1397918343.10748.help-gnu-emacs@gnu.org>
@ 2014-04-20  8:18     ` Javier
  0 siblings, 0 replies; 9+ messages in thread
From: Javier @ 2014-04-20  8:18 UTC (permalink / raw)
  To: help-gnu-emacs


I navigate frames like in screen, but don't access them by number.
I just press Shit+Left/Right arrow to move between them.

;; navigate frames with Shift + arrows
(defun other-frame-dec () "" (interactive) (other-frame '+1))
(defun other-frame-inc () "" (interactive) (other-frame '-1))
(global-set-key [S-left] 'other-frame-dec)
(global-set-key [S-right] 'other-frame-inc)

;;Some usefuld keybindings for dealing with frames:
(global-set-key [f4] 'delete-frame)  ;originally bound to call-kbd-macro (also accessible with C-x e)
(global-set-key [C-f4] 'delete-frame)
; Kill frames instead of hiding them by pressing q (completition buffers, ...)
(setq frame-auto-hide-function 'delete-frame)


Joshua Studen <joshua.studen@gmail.com> wrote:
> Number 1 is what I do now, it's just a lot a bit of a slow-down to have to
> do it multiple times if I have multiple frames.
> 
> #2 is very close. The ONLY issue is that I use emacs both via GUI locally
> and on a remote machine, I do emacs --daemon.  When I leave the remote
> session, and come back and create a new Emacs client, the frame numbers do
> NOT start back at F1,
> 
> I need a combination of your #2 and the suggested M-x set-frame-name. Maybe
> next emacs, there will be a way to set a frame name :).
> 
> Thanks, all.
> 
> 
> On Fri, Apr 18, 2014 at 9:07 PM, Drew Adams <drew.adams@oracle.com> wrote:
> 
>> > Is there an easy way to have numbered frames in Emacs? I guess, I'd like
>> to
>> > setup my environment similar to what screen/tmux offer. I've found
>> > elscreen, but after using it for a while, I find it more of a distraction
>> > rather than an aid.
>> >
>> > Like with Tmux or screen, I can do C-b (or C-a) and then a number and it
>> > will switch to that screen/tmux pane. I think it COULD be possible with
>> > Emacs, but I don't know how to do it.
>> >
>> > Any advice or suggestions?
>>
>> This might be some help, though it does not seem to be exactly what you
>> are requesting.
>>
>> 1. `C-x 5 o' cycles among the available frames.  This is true even if you
>> use Emacs in a terminal (i.e., without a graphic display) - see the Emacs
>> manual, node `Non-Window Terminals'.
>>
>> 2. Command `select-frame-by-name' raises and selects a frame by name,
>> providing completion.  Again, this works also without a graphic display.
>> Frame names in a terminal are simple by default: FN1, FN2, etc.
>> Bind the command to a key, e.g., `C-a' as you suggested.  Then
>> `C-a TAB 3' takes you to frame FN3.
>>


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

end of thread, other threads:[~2014-04-20  8:18 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-04-18 21:34 Frame numbering Joshua Studen
2014-04-19  1:07 ` Drew Adams
2014-04-19 14:39   ` Joshua Studen
2014-04-19 19:42     ` Drew Adams
     [not found]   ` <mailman.19880.1397918343.10748.help-gnu-emacs@gnu.org>
2014-04-20  8:18     ` Javier
2014-04-19  6:32 ` Eli Zaretskii
2014-04-19  8:17   ` Alan Schmitt
2014-04-19  8:42     ` Eli Zaretskii
2014-04-19 11:00       ` Alan Schmitt

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.