From: Emanuel Berg <incal@dataswamp.org>
To: help-gnu-emacs@gnu.org
Subject: Re: Is there equivalent C-l for columns?
Date: Wed, 15 Jun 2022 13:40:23 +0200 [thread overview]
Message-ID: <87wndi6tp4.fsf@dataswamp.org> (raw)
In-Reply-To: YqnBDMq2KzrSINYr@protected.localdomain
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
next prev parent reply other threads:[~2022-06-15 11:40 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
2022-06-15 11:29 ` Emanuel Berg
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87wndi6tp4.fsf@dataswamp.org \
--to=incal@dataswamp.org \
--cc=help-gnu-emacs@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.