From: Michael Gallagher - NOAA Affiliate via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 50506@debbugs.gnu.org, Lars Ingebrigtsen <larsi@gnus.org>
Subject: bug#50506: 28.0.50; display-line-numbers equivalent for linum-format?
Date: Wed, 15 Sep 2021 09:22:18 -0600 [thread overview]
Message-ID: <CA+e+kb37jEM29wUuE-TC-BGm12Pd8EWCEKC=buF0mtqHvi8W4A@mail.gmail.com> (raw)
In-Reply-To: <834kancb73.fsf@gnu.org>
[-- Attachment #1.1: Type: text/plain, Size: 1250 bytes --]
Eli, I did indeed. I've added corrections to account for L2R vs R2L and the
updated patch is attached. Let me know what you think
On Tue, Sep 14, 2021 at 11:35 AM Eli Zaretskii <eliz@gnu.org> wrote:
> > From: Michael Gallagher - NOAA Affiliate <michael.r.gallagher@noaa.gov>
> > Date: Tue, 14 Sep 2021 10:17:31 -0600
> > Cc: Lars Ingebrigtsen <larsi@gnus.org>, 50506@debbugs.gnu.org
> >
> > OK. Here we go. I found some time last night. Attached is a git patch
> file for changes that implement this
> > feature request as well as (GNU) diffs for the individual files in
> question. It's a pretty simple commit. It's worth
> > noting that I'm probably overlooking something in how I create the
> glyph, I definitely don't understand the
> > nuances of the display code. But I hope it's helpful.
>
> Thanks. But I don't see that you did anything about the problem with
> R2L lines. What happens if you turn on display-line-numbers-mode in
> the buffer that visits TUTORIAL.he, and then turn on this feature in
> that buffer? don't you see the separator line on the wrong side of the
> line numbers?
>
--
Michael Gallagher, PhD
CIRES Research Scientist
Polar Observations and Processes Team (ESRL/NOAA/PSD)
325 Broadway, Boulder, Colorado 80305
[-- Attachment #1.2: Type: text/html, Size: 2287 bytes --]
[-- Attachment #2: 0021-inclusion-of-line-number-separator-character.patch --]
[-- Type: text/x-patch, Size: 3631 bytes --]
From 550d2716feb78cf6353e8d9a8f63b7fd12adfd83 Mon Sep 17 00:00:00 2001
From: polair <michael.r.gallagher@noaa.gov>
Date: Wed, 15 Sep 2021 09:18:58 -0600
Subject: [PATCH 21/21] inclusion of line number separator character
---
lisp/cus-start.el | 6 ++++++
lisp/frame.el | 1 +
src/xdisp.c | 24 ++++++++++++++++++++++++
3 files changed, 31 insertions(+)
diff --git a/lisp/cus-start.el b/lisp/cus-start.el
index 1a3e5682bba..c755aaa41cf 100644
--- a/lisp/cus-start.el
+++ b/lisp/cus-start.el
@@ -740,6 +740,12 @@ minibuffer-prompt-properties--setter
(const :tag "Visually relative line numbers"
:value visual))
"26.1")
+ (display-line-numbers-separator-character
+ display-line-numbers
+ (character :tag "Character to separate numbers from buffer")
+ :safe (lambda (value) (or (characterp value) (null value)))
+ "28.05")
+ ;:safe (lambda (value) (or (characterp value) (null value))))
(display-line-numbers-width
display-line-numbers
(choice
diff --git a/lisp/frame.el b/lisp/frame.el
index 60234fc2ae9..c6975a71cf2 100644
--- a/lisp/frame.el
+++ b/lisp/frame.el
@@ -2876,6 +2876,7 @@ set-frame-property--interactive
header-line-format
tab-line-format
display-line-numbers
+ display-line-numbers-separator-character
display-line-numbers-width
display-line-numbers-current-absolute
display-line-numbers-widen
diff --git a/src/xdisp.c b/src/xdisp.c
index d30a68570f0..32fc6089292 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -23265,6 +23265,14 @@ maybe_produce_line_number (struct it *it)
tem_it.face_id = merge_faces (it->w, Qline_number_minor_tick,
0, DEFAULT_FACE_ID);
}
+ if (FIXNATP (Vdisplay_line_numbers_separator_character)
+ && it->paragraph_embedding != L2R)
+ {
+ tem_it.c = tem_it.char_to_display = XFIXNAT (Vdisplay_line_numbers_separator_character);
+ tem_it.len = 1;
+ SET_TEXT_POS (tem_it.position, -1, -1);
+ PRODUCE_GLYPHS (&tem_it);
+ }
/* Produce glyphs for the line number in a scratch glyph_row. */
for (const char *p = lnum_buf; *p; p++)
@@ -23296,6 +23304,15 @@ maybe_produce_line_number (struct it *it)
}
}
+ if (FIXNATP (Vdisplay_line_numbers_separator_character)
+ && it->paragraph_embedding == L2R)
+ {
+ tem_it.c = tem_it.char_to_display = XFIXNAT (Vdisplay_line_numbers_separator_character);
+ tem_it.len = 1;
+ SET_TEXT_POS (tem_it.position, -1, -1);
+ PRODUCE_GLYPHS (&tem_it);
+ }
+
inhibit_free_realized_faces = save_free_realized_faces;
/* Record the width in pixels we need for the line number display. */
@@ -35509,6 +35526,13 @@ syms_of_xdisp (void)
DEFSYM (Qrelative, "relative");
DEFSYM (Qvisual, "visual");
+ DEFVAR_LISP ("display-line-numbers-separator-character", Vdisplay_line_numbers_separator_character,
+ doc: /* Character to draw between line numbers and buffer when non-nil. Some interesting
+options are: ├, ╞, │, ┃, ║, ▶, ⧽, and ⟫ */);
+ Vdisplay_line_numbers_separator_character = Qnil;
+ DEFSYM (Qdisplay_line_numbers_separator_character, "display-line-numbers-separator-character");
+ //Fmake_variable_buffer_local (Qdisplay_line_numbers_separator_character);
+
DEFVAR_LISP ("display-line-numbers-width", Vdisplay_line_numbers_width,
doc: /* Minimum width of space reserved for line number display.
A positive number means reserve that many columns for line numbers,
--
2.33.0
next prev parent reply other threads:[~2021-09-15 15:22 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-10 7:40 bug#50506: 28.0.50; display-line-numbers equivalent for linum-format? Michael Gallagher (CIRES/NOAA) via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-09-10 12:30 ` Eli Zaretskii
2021-09-10 16:00 ` Michael Gallagher - NOAA Affiliate via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-09-11 11:53 ` Eli Zaretskii
2021-09-11 12:03 ` Lars Ingebrigtsen
2021-09-13 17:54 ` Michael Gallagher - NOAA Affiliate via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-09-13 18:05 ` Eli Zaretskii
2021-09-13 18:17 ` Michael Gallagher - NOAA Affiliate via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-09-13 18:27 ` Eli Zaretskii
2021-09-14 16:17 ` Michael Gallagher - NOAA Affiliate via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-09-14 17:24 ` Michael Gallagher - NOAA Affiliate via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-09-14 17:35 ` Eli Zaretskii
2021-09-15 15:22 ` Michael Gallagher - NOAA Affiliate via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2021-09-15 15:49 ` Eli Zaretskii
2021-09-15 16:08 ` Michael Gallagher - NOAA Affiliate via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-09-15 16:26 ` Eli Zaretskii
2021-09-15 16:45 ` Michael Gallagher - NOAA Affiliate via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-09-15 16:53 ` Eli Zaretskii
2021-09-15 17:32 ` Michael Gallagher - NOAA Affiliate via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-09-15 18:10 ` Eli Zaretskii
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CA+e+kb37jEM29wUuE-TC-BGm12Pd8EWCEKC=buF0mtqHvi8W4A@mail.gmail.com' \
--to=bug-gnu-emacs@gnu.org \
--cc=50506@debbugs.gnu.org \
--cc=eliz@gnu.org \
--cc=larsi@gnus.org \
--cc=michael.r.gallagher@noaa.gov \
/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 public inbox
https://git.savannah.gnu.org/cgit/emacs.git
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).