emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Native line numbers landed on master


From: Johan Bockgård
Subject: Re: Native line numbers landed on master
Date: Fri, 04 Oct 2019 17:57:52 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

Juanma Barranquero <address@hidden> writes:

> +  DEFVAR_LISP ("display-line-numbers-major-tick", 
> Vdisplay_line_numbers_major_tick,
> +    doc: /* If an integer N > 0, highlight line number of every Nth line.
> +The line number is shown with the `line-number-major-tick' face.
> +Otherwise, no special highlighting is done every Nth line.
> +Note that major ticks take precedence over minor ticks.  */);
> +  Vdisplay_line_numbers_major_tick = make_fixnum (0);

Why not use DEFVAR_INT?

> +  DEFSYM (Qdisplay_line_numbers_major_tick, 
> "display-line-numbers-major-tick");
> +  Fmake_variable_buffer_local (Qdisplay_line_numbers_major_tick);

I realize that many existing variables in xdisp.c don't follow this
recommendation, but the manual says the following:

     *Warning:* Don’t assume that you should use
     ‘make-variable-buffer-local’ for user-option variables, simply
     because users _might_ want to customize them differently in
     different buffers.  Users can make any variable local, when they
     wish to.  It is better to leave the choice to them.

     The time to use ‘make-variable-buffer-local’ is when it is crucial
     that no two buffers ever share the same binding.  For example, when
     a variable is used for internal purposes in a Lisp program which
     depends on having separate values in separate buffers, then using
     ‘make-variable-buffer-local’ can be the best solution.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]