[Top][All Lists]

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

bug#34022: 26.1; Region highlight has lower priority than flymake overla

From: Johann Klähn
Subject: bug#34022: 26.1; Region highlight has lower priority than flymake overlays
Date: Wed, 09 Jan 2019 21:33:37 +0100

I just noticed a bug (?) that region becomes de-facto "invisible" due to its 
highlight overlay having a lower priority than the flymake overlays. This only 
happens when both region and flymake diagnostics are indicated using the same 
face property (background in my case). It becomes more apparent for larger 
flymake overlays.

Steps to reproduce, starting from emacs -Q:

• M-: (set-face-background flymake-note "yellow green")
• M-x find-library flymake (or any file where there will be flymake diagnostics)
• M-x flymake-mode
• Jump to a docstring/line/paragraph highlighted using e.g. the `flymake-note' 
• With transient-mark-mode enabled select regions that overlap with the
  flymake overlay. ⇒ The region is not highlighted since the background
 face property given by the flymake overlay takes precedence.

Relevant extract from simple.el.gz, where the secondary priority for
the region highlight overlay is set to 100:

> (defvar redisplay-highlight-region-function
>   (lambda (start end window rol)
>     (if (not (overlayp rol))
>         (let ((nrol (make-overlay start end)))
>           (funcall redisplay-unhighlight-region-function rol)
>           (overlay-put nrol 'window window)
>           (overlay-put nrol 'face 'region)
>           ;; Normal priority so that a large region doesn't hide all the
>           ;; overlays within it, but high secondary priority so that if it
>           ;; ends/starts in the middle of a small overlay, that small overlay
>           ;; won't hide the region's boundaries.
>           (overlay-put nrol 'priority '(nil . 100))
>           nrol)
>       (unless (and (eq (overlay-buffer rol) (current-buffer))
>                    (eq (overlay-start rol) start)
>                    (eq (overlay-end rol) end))
>         (move-overlay rol start end (current-buffer)))
>       rol)))

Flymake uses 100 as the offset to compute the default priority for its overlays:

> (defun flymake--highlight-line (diagnostic)
>   "Highlight buffer with info in DIAGNOSTIC."
>   (when-let* ((ov (make-overlay
>                    (flymake--diag-beg diagnostic)
>                    (flymake--diag-end diagnostic))))
>     ;; First set `category' in the overlay, then copy over every other
>     ;; property.
>     ;;
>     (let ((alist (assoc-default (flymake--diag-type diagnostic)
>                                 flymake-diagnostic-types-alist)))
>       (overlay-put ov 'category (assoc-default 'flymake-category alist))
>       (cl-loop for (k . v) in alist
>                unless (eq k 'category)
>                do (overlay-put ov k v)))
>     ;; Now ensure some essential defaults are set
>     ;;
>     (cl-flet ((default-maybe
>                 (prop value)
>                 (unless (or (plist-member (overlay-properties ov) prop)
>                             (let ((cat (overlay-get ov
>                                                     'flymake-category)))
>                               (and cat
>                                    (plist-member (symbol-plist cat) prop))))
>                   (overlay-put ov prop value))))
>       (default-maybe 'bitmap 'flymake-error-bitmap)
>       (default-maybe 'face 'flymake-error)
>       (default-maybe 'before-string
>         (flymake--fringe-overlay-spec
>          (overlay-get ov 'bitmap)))
>       (default-maybe 'help-echo
>         (lambda (window _ov pos)
>           (with-selected-window window
>             (mapconcat
>              #'flymake--diag-text
>              (flymake-diagnostics pos)
>              "\n"))))
>       (default-maybe 'severity (warning-numeric-level :error))
>       (default-maybe 'priority (+ 100 (overlay-get ov 'severity))))
>     ;; Some properties can't be overridden.
>     ;;
>     (overlay-put ov 'evaporate t)
>     (overlay-put ov 'flymake-diagnostic diagnostic)))

Is it intentional that 100 is used as the offset here? This has the effect that 
most priorities will be above that of the region overlay.


In GNU Emacs 26.1 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.22.30)
 of 2018-07-05 built on juergen
Windowing system distributor 'The X.Org Foundation', version 11.0.12003000
Recent messages:

Configured using:
 'configure --prefix=/usr --sysconfdir=/etc --libexecdir=/usr/lib
 --localstatedir=/var --with-x-toolkit=gtk3 --with-xft --with-modules
 'CFLAGS=-march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong

Configured features:

Important settings:
  value of $LC_ALL: en_US.UTF-8
  value of $LC_MESSAGES: C
  value of $LANG: de_DE.utf8
  locale-coding-system: utf-8-unix

Major mode: Emacs-Lisp

Minor modes in effect:
  flymake-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  eldoc-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  buffer-read-only: t
  line-number-mode: t
  transient-mark-mode: t

Load-path shadows:
None found.

(shadow sort mail-extr emacsbug message rmc puny seq dired
dired-loaddefs format-spec rfc822 mml mml-sec password-cache epa derived
epg epg-config gnus-util rmail rmail-loaddefs mm-decode mm-bodies
mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail
rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils cl-extra
help-fns radix-tree cl-print byte-opt bytecomp byte-compile cconv debug
face-remap misearch multi-isearch noutline outline easy-mmode lisp-mnt
checkdoc cl-macs gv cl-seq flymake-proc flymake compile comint
ansi-color ring warnings help-mode easymenu cl-loaddefs cl-lib jka-compr
thingatpt find-func elec-pair time-date mule-util tooltip eldoc electric
uniquify ediff-hook vc-hooks lisp-float-type mwheel term/x-win x-win
term/common-win x-dnd tool-bar dnd fontset image regexp-opt fringe
tabulated-list replace newcomment text-mode elisp-mode lisp-mode
prog-mode register page menu-bar rfn-eshadow isearch timer select
scroll-bar mouse jit-lock font-lock syntax facemenu font-core
term/tty-colors frame cl-generic cham georgian utf-8-lang misc-lang
vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms cp51932
hebrew greek romanian slovak czech european ethiopic indian cyrillic
chinese composite charscript charprop case-table epa-hook jka-cmpr-hook
help simple abbrev obarray minibuffer cl-preloaded nadvice loaddefs
button faces cus-face macroexp files text-properties overlay sha1 md5
base64 format env code-pages mule custom widget hashtable-print-readable
backquote dbusbind inotify lcms2 dynamic-setting system-font-setting
font-render-setting move-toolbar gtk x-toolkit x multi-tty
make-network-process emacs)

Memory information:
((conses 16 123857 7080)
 (symbols 48 22067 1)
 (miscs 40 144 289)
 (strings 32 35534 1170)
 (string-bytes 1 922022)
 (vectors 16 17358)
 (vector-slots 8 524383 14202)
 (floats 8 67 298)
 (intervals 56 2057 393)
 (buffers 992 18))

reply via email to

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