* Is there equivalent C-l for columns?
@ 2022-06-15 8:21 Jean Louis
2022-06-15 9:00 ` Emanuel Berg
2022-06-15 10:29 ` Michael Heerdegen
0 siblings, 2 replies; 10+ messages in thread
From: Jean Louis @ 2022-06-15 8:21 UTC (permalink / raw)
To: Help GNU Emacs
C-l is very handy, it may center my cursor or bring it to the top or
bottom, however it works horizontally on text rows or lines.
I have file with long lines which I edit without wrapping and it
becomes difficult when I am editing those characters in columns longer
than the available window space in Emacs.
So I am just assuming there could be some solution for long lines to
bring the focus into window easier, similar to C-l
Jean
Take action in Free Software Foundation campaigns:
https://www.fsf.org/campaigns
In support of Richard M. Stallman
https://stallmansupport.org/
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Is there equivalent C-l for columns?
2022-06-15 8:21 Is there equivalent C-l for columns? Jean Louis
@ 2022-06-15 9:00 ` Emanuel Berg
2022-06-15 10:29 ` Michael Heerdegen
1 sibling, 0 replies; 10+ messages in thread
From: Emanuel Berg @ 2022-06-15 9:00 UTC (permalink / raw)
To: help-gnu-emacs
Jean Louis wrote:
> I have file with long lines which I edit without wrapping
> and it becomes difficult when I am editing those characters
> in columns longer than the available window space in Emacs.
Yep, avoid that situation.
> So I am just assuming there could be some solution for long
> lines to bring the focus into window easier, similar to C-l
(defun recenter-col ()
(interactive)
(let ((beg (point-at-bol))
(end (point-at-eol)) )
(goto-char (+ beg (/ (- end beg) 2)) )))
(defalias 'rc #'recenter-col)
--
underground experts united
https://dataswamp.org/~incal
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Is there equivalent C-l for columns?
2022-06-15 8:21 Is there equivalent C-l for columns? Jean Louis
2022-06-15 9:00 ` Emanuel Berg
@ 2022-06-15 10:29 ` Michael Heerdegen
2022-06-15 11:08 ` Michael Heerdegen
` (2 more replies)
1 sibling, 3 replies; 10+ messages in thread
From: Michael Heerdegen @ 2022-06-15 10:29 UTC (permalink / raw)
To: help-gnu-emacs
Jean Louis <bugs@gnu.support> writes:
> C-l is very handy, it may center my cursor or bring it to the top or
> bottom, however it works horizontally on text rows or lines.
>
> I have file with long lines which I edit without wrapping and it
> becomes difficult when I am editing those characters in columns longer
> than the available window space in Emacs.
>
> So I am just assuming there could be some solution for long lines to
> bring the focus into window easier, similar to C-l
There are scroll commands that scroll horizontally, but such a horizontal
recenter sounds very useful.
Seems it already has been invented: `w3m-horizontal-recenter' in w3m and
`gnus-horizontal-recenter' in Gnus. The w3m command seems to work fine,
the Gnus command doesn't do anything for me.
Michael.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Is there equivalent C-l for columns?
2022-06-15 10:29 ` Michael Heerdegen
@ 2022-06-15 11:08 ` Michael Heerdegen
2022-06-15 11:36 ` Emanuel Berg
2022-06-15 11:22 ` Jean Louis
2022-06-15 11:29 ` Emanuel Berg
2 siblings, 1 reply; 10+ messages in thread
From: Michael Heerdegen @ 2022-06-15 11:08 UTC (permalink / raw)
To: help-gnu-emacs
Michael Heerdegen <michael_heerdegen@web.de> writes:
> There are scroll commands that scroll horizontally, but such a horizontal
> recenter sounds very useful.
We have a feature request for this: bug#30747.
Michael.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Is there equivalent C-l for columns?
2022-06-15 10:29 ` Michael Heerdegen
2022-06-15 11:08 ` Michael Heerdegen
@ 2022-06-15 11:22 ` Jean Louis
2022-06-15 11:33 ` Michael Heerdegen
2022-06-15 11:40 ` Emanuel Berg
2022-06-15 11:29 ` Emanuel Berg
2 siblings, 2 replies; 10+ messages in thread
From: Jean Louis @ 2022-06-15 11:22 UTC (permalink / raw)
To: Michael Heerdegen; +Cc: help-gnu-emacs
* Michael Heerdegen <michael_heerdegen@web.de> [2022-06-15 13:31]:
> Seems it already has been invented: `w3m-horizontal-recenter' in w3m and
> `gnus-horizontal-recenter' in Gnus. The w3m command seems to work fine,
> the Gnus command doesn't do anything for me.
I wish it would work, and I tried it.
Gnus one I cannot find after loading gnus library.
w3m one only do very small movement, it does not recenter my text in
the center of window.
--
Jean
Take action in Free Software Foundation campaigns:
https://www.fsf.org/campaigns
In support of Richard M. Stallman
https://stallmansupport.org/
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Is there equivalent C-l for columns?
2022-06-15 10:29 ` Michael Heerdegen
2022-06-15 11:08 ` Michael Heerdegen
2022-06-15 11:22 ` Jean Louis
@ 2022-06-15 11:29 ` Emanuel Berg
2 siblings, 0 replies; 10+ messages in thread
From: Emanuel Berg @ 2022-06-15 11:29 UTC (permalink / raw)
To: help-gnu-emacs
Michael Heerdegen wrote:
> There are scroll commands that scroll horizontally
Indeed, for example
;; scroll horizontally
(put 'scroll-left 'disabled nil)
(put 'scroll-right 'disabled nil)
(setq hscroll-margin 1)
(setq hscroll-step 1)
(defun scroll-left-1 ()
(interactive)
(scroll-right 1 0) ) ; yes, "the opposite" here
(defun scroll-right-1 ()
(interactive)
(scroll-left 1 0) ) ; ditto
A lot more on civilized scrolling,
https://dataswamp.org/~incal/emacs-init/scroll.el
--
underground experts united
https://dataswamp.org/~incal
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Is there equivalent C-l for columns?
2022-06-15 11:22 ` Jean Louis
@ 2022-06-15 11:33 ` Michael Heerdegen
2022-06-15 11:40 ` Emanuel Berg
1 sibling, 0 replies; 10+ messages in thread
From: Michael Heerdegen @ 2022-06-15 11:33 UTC (permalink / raw)
To: help-gnu-emacs
Jean Louis <bugs@gnu.support> writes:
> Gnus one I cannot find after loading gnus library.
`gnus-horizontal-recenter' (a function, not a command) is in
"gnus.util.el". It only does something when there are lines larger than
the window width AFAIU.
> w3m one only do very small movement, it does not recenter my text in
> the center of window.
Works perfectly here. It recenters the cursor position horizontally
here.
Michael.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Is there equivalent C-l for columns?
2022-06-15 11:08 ` Michael Heerdegen
@ 2022-06-15 11:36 ` Emanuel Berg
2022-06-15 11:43 ` Robert Pluim
0 siblings, 1 reply; 10+ messages in thread
From: Emanuel Berg @ 2022-06-15 11:36 UTC (permalink / raw)
To: help-gnu-emacs
Michael Heerdegen wrote:
>> There are scroll commands that scroll horizontally, but
>> such a horizontal recenter sounds very useful.
>
> We have a feature request for this: bug#30747.
Good work! \o/
What did you say?
And how do you file feature requests?
--
underground experts united
https://dataswamp.org/~incal
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Is there equivalent C-l for columns?
2022-06-15 11:22 ` Jean Louis
2022-06-15 11:33 ` Michael Heerdegen
@ 2022-06-15 11:40 ` Emanuel Berg
1 sibling, 0 replies; 10+ messages in thread
From: Emanuel Berg @ 2022-06-15 11:40 UTC (permalink / raw)
To: help-gnu-emacs
Jean Louis wrote:
>> Seems it already has been invented:
>> `w3m-horizontal-recenter' in w3m and
>> `gnus-horizontal-recenter' in Gnus. The w3m command seems
>> to work fine, the Gnus command doesn't do anything for me.
>
> I wish it would work, and I tried it.
>
> Gnus one I cannot find after loading gnus library.
It is in gnus-util.el, line 567-590:
(defun gnus-horizontal-recenter ()
"Recenter the current buffer horizontally."
(if (< (current-column) (/ (window-width) 2))
(set-window-hscroll (gnus-get-buffer-window (current-buffer) t) 0)
(let* ((orig (point))
(end (window-end (gnus-get-buffer-window (current-buffer) t)))
(max 0))
(when end
;; Find the longest line currently displayed in the window.
(goto-char (window-start))
(while (and (not (eobp))
(< (point) end))
(end-of-line)
(setq max (max max (current-column)))
(forward-line 1))
(goto-char orig)
;; Scroll horizontally to center (sort of) the point.
(if (> max (window-width))
(set-window-hscroll
(gnus-get-buffer-window (current-buffer) t)
(min (- (current-column) (/ (window-width) 3))
(+ 2 (- max (window-width)))))
(set-window-hscroll (gnus-get-buffer-window (current-buffer) t) 0))
max))))
To be Gnus a pretty short function LOL :)
GNU Emacs 29.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version
3.24.24, cairo version 1.16.0) of 2022-05-28
[commit 79ae40c8e4dac5898d68c92f26f625ac400b960c]
--
underground experts united
https://dataswamp.org/~incal
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Is there equivalent C-l for columns?
2022-06-15 11:36 ` Emanuel Berg
@ 2022-06-15 11:43 ` Robert Pluim
0 siblings, 0 replies; 10+ messages in thread
From: Robert Pluim @ 2022-06-15 11:43 UTC (permalink / raw)
To: help-gnu-emacs
>>>>> On Wed, 15 Jun 2022 13:36:41 +0200, Emanuel Berg <incal@dataswamp.org> said:
Emanuel> And how do you file feature requests?
M-x report-emacs-bug
and then put something like "RFE" or "Enhancement request" in the
subject, provide a fairly detailed description of what youʼre after,
and why, and then see what happens.
Robert
--
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2022-06-15 11:43 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-06-15 8:21 Is there equivalent C-l for columns? Jean Louis
2022-06-15 9:00 ` Emanuel Berg
2022-06-15 10:29 ` Michael Heerdegen
2022-06-15 11:08 ` Michael Heerdegen
2022-06-15 11:36 ` Emanuel Berg
2022-06-15 11:43 ` Robert Pluim
2022-06-15 11:22 ` Jean Louis
2022-06-15 11:33 ` Michael Heerdegen
2022-06-15 11:40 ` Emanuel Berg
2022-06-15 11:29 ` Emanuel Berg
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.