emacs-devel
[Top][All Lists]
Advanced

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

Re: Fill column indicator functionality


From: Ergus
Subject: Re: Fill column indicator functionality
Date: Fri, 5 Apr 2019 20:11:33 +0200
User-agent: NeoMutt/20180716

Hi Eli:

On Fri, Apr 05, 2019 at 06:28:40PM +0300, Eli Zaretskii wrote:
Date: Fri, 05 Apr 2019 16:06:17 +0300
From: Eli Zaretskii <address@hidden>
Cc: address@hidden

Once you can reproduce the problem, I suggest to use the macro
FACE_FOR_CHAR to find the ID of a face suitable for displaying the
indicator character, instead of using DEFAULT_FACE_ID.  You can find
examples of using this macro elsewhere in xdisp.c.

On second thought, I think using FACE_FOR_CHAR would produce
unpleasant results.  If the font required to display U+2502 is not the
default font, it could be higher than the default font, which will
cause the line height become larger on those screen lines where the
indicator is displayed.  The result will cause complaints.

I have a version already implemented with this solution and I don't
like it for the reasons you expose.

So I think we should insist on being able to display the indicator
character by the default face's font.  Whether this is possible could
be tested by comparing the font returned by internal-char-font and the
default face's font returned by face-font.  Like this:

 (if (eq (aref (car (internal-char-font nil ?│)) 0)
         w(face-font 'default))
      ;; can use the default font for U+2502

(But we should use the actual value of
display-fill-column-indicator-char instead of the literal character.)

WDYT?

Actually this is what we have now:

(define-minor-mode display-fill-column-indicator-mode
 "Toggle display fill column indicator.
This uses `display-fill-column-indicator' internally.

To change the position of the column displayed by default,
customize `display-fill-column-indicator-column' you can change the
character for the indicator setting `display-fill-column-indicator-character'."
 :lighter nil
 (if display-fill-column-indicator-mode
     (progn
       (setq display-fill-column-indicator t)
       (unless display-fill-column-indicator-character
         (if (char-displayable-p ?\u2502)
             (setq display-fill-column-indicator-character ?\u2502)
           (setq display-fill-column-indicator-character ?|))))
   (setq display-fill-column-indicator nil)))


I think we only need to extend the inner if with your condition, but I
got an error because (internal-char-font nil ?│) always return nil in a
terminal and aref has issues with that.

Debugger entered--Lisp error: (wrong-type-argument arrayp nil)
 aref(nil 0)
 eval((aref (car (internal-char-font nil 9474)) 0) nil)
 elisp--eval-last-sexp(nil)
 #f(compiled-function (eval-last-sexp-arg-internal) "Evaluate sexp before point; print value in the 
echo area.\nInteractively, with a non `-' prefix argument, print output into\ncurrent 
buffer.\n\nNormally, this function truncates long output according to the\nvalue of the variables 
`eval-expression-print-length' and\n`eval-expression-print-level'.  With a prefix argument of 
zero,\nhowever, there is no such truncation.\nInteger values are printed in several formats (decimal, 
octal,\nand hexadecimal).  When the prefix argument is -1 or the value\ndoesn't exceed 
`eval-expression-print-maximum-character', an\ninteger value is also printed as a character of that 
codepoint.\n\nIf `eval-expression-debug-on-error' is non-nil, which is the default,\nthis command 
arranges for all errors to enter the debugger." (interactive "P") #<bytecode 
0x1fdfdd428807>)(nil)
 apply(#f(compiled-function (eval-last-sexp-arg-internal) "Evaluate sexp before point; print value 
in the echo area.\nInteractively, with a non `-' prefix argument, print output into\ncurrent 
buffer.\n\nNormally, this function truncates long output according to the\nvalue of the variables 
`eval-expression-print-length' and\n`eval-expression-print-level'.  With a prefix argument of 
zero,\nhowever, there is no such truncation.\nInteger values are printed in several formats (decimal, 
octal,\nand hexadecimal).  When the prefix argument is -1 or the value\ndoesn't exceed 
`eval-expression-print-maximum-character', an\ninteger value is also printed as a character of that 
codepoint.\n\nIf `eval-expression-debug-on-error' is non-nil, which is the default,\nthis command 
arranges for all errors to enter the debugger." (interactive "P") #<bytecode 
0x1fdfdd428807>) nil)
 eval-last-sexp(nil)
 funcall-interactively(eval-last-sexp nil)
 call-interactively(eval-last-sexp nil nil)
 command-execute(eval-last-sexp)

In a gui I get this error:

Debugger entered--Lisp error: (wrong-type-argument arrayp #<font-object 
"-1ASC-Liberation Mono-normal-normal-normal-*-15-*-*-*-*-0-iso10646-1">)
 aref(#<font-object "-1ASC-Liberation 
Mono-normal-normal-normal-*-15-*-*-*-*-0-iso10646-1"> 0)
 eval((aref (car (internal-char-font nil 9474)) 0) nil)
 elisp--eval-last-sexp(nil)
 eval-last-sexp(nil)
 funcall-interactively(eval-last-sexp nil)
 call-interactively(eval-last-sexp nil nil)
 command-execute(eval-last-sexp)

Could we use something else?




reply via email to

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