unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
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: Tue, 14 Sep 2021 10:17:31 -0600	[thread overview]
Message-ID: <CA+e+kb07L+eV2ynWJT4wK7qHFLm3ZEFpmDB-J1Z+4usx7u3EFw@mail.gmail.com> (raw)
In-Reply-To: <83pmtccovd.fsf@gnu.org>


[-- Attachment #1.1: Type: text/plain, Size: 1315 bytes --]

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.

On Mon, Sep 13, 2021 at 12:27 PM Eli Zaretskii <eliz@gnu.org> wrote:

> > From: Michael Gallagher - NOAA Affiliate <michael.r.gallagher@noaa.gov>
> > Date: Mon, 13 Sep 2021 12:17:09 -0600
> > Cc: Lars Ingebrigtsen <larsi@gnus.org>, 50506@debbugs.gnu.org
> >
> > Funny enough, that's *exactly* what I tried to do, but I ran into
> problems getting the variable to display in
> > customize-variable (a problem with what I put in cus-start.el?) and if I
> manually used setq it didn't seem to
> > get translated correctly by the way I coded the macro.
>
> I think if you look up all the pieces that handle
> display-fill-column-indicator-character, both in C and in Lisp, you
> will have your answers.  Feel free to ask specific questions if
> something is still unclear after that.
>


-- 
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: 2348 bytes --]

[-- Attachment #2: individual_diffs.tgz --]
[-- Type: application/x-compressed-tar, Size: 1203 bytes --]

[-- Attachment #3: 0021-add-new-variable-for-optional-character-to-end-of-li.patch --]
[-- Type: text/x-patch, Size: 3089 bytes --]

From f4c5fd9a8d49f6c1be66c2fddd3f506dcc92d547 Mon Sep 17 00:00:00 2001
From: polair <michael.r.gallagher@noaa.gov>
Date: Tue, 14 Sep 2021 10:12:14 -0600
Subject: [PATCH 21/21] add new variable for optional character to end of
 line-numbers line

---
 lisp/cus-start.el |  6 ++++++
 lisp/frame.el     |  1 +
 src/xdisp.c       | 16 ++++++++++++++++
 3 files changed, 23 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..92225af685a 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -23296,6 +23296,15 @@ maybe_produce_line_number (struct it *it)
 	}
     }
 
+  /* if last character in string, and separator is set, draw separator glyph */
+  if (FIXNATP (Vdisplay_line_numbers_separator_character))
+    {
+      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 +35518,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


  reply	other threads:[~2021-09-14 16:17 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 [this message]
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
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+kb07L+eV2ynWJT4wK7qHFLm3ZEFpmDB-J1Z+4usx7u3EFw@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).