[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Empty Overlay with before-string or after-string property still treated
From: |
M Jared Finder |
Subject: |
Empty Overlay with before-string or after-string property still treated as empty |
Date: |
Sat, 18 Feb 2006 23:57:02 -0800 |
If you an overlay has equal endpoints, and a before-string or after-string
property set, the face
property does not affect the before-string or after-string. I found this while
modifying hl-line to
properly handle the last line in a buffer.
Steps to reproduce:
1. Redefine hl-line-move as follows:
(defun hl-line-move (overlay)
"Move the Hl-Line overlay.
If `h l-line-range-function' is non-nil, move the OVERLAY to the position
where the function returns. If `hl-line-range-function' is nil, fill
the line including the point by OVERLAY."
(let (tmp b e)
(if hl-line-range-function
(setq tmp (funcall hl-line-range-function)
b (car tmp)
e (cdr tmp))
(setq tmp t
b (line-beginning-position)
e (line-beginning-position 2)))
(overlay-put hl-line-overlay 'after-string (if (and (same-line-p b e) (=
e (point-max)))
"\n" nil))
;(when (same-line-p b e) (decf b))
(if tmp
(move-overlay overlay b e)
(move-overlay overlay 1 1))))
2. Add the definition of same-line-p:
(defun same-line-p (pos1 pos2)
"Return t if buffer positions POS1 and POS2 are on the same line."
(save-excursion (goto-char (min pos1 pos2))
(<= (max pos1 pos2) (line-end-position))))
3. Enable hl-line-mode.
4. Go to the very last line of a file with no text on the last line (i.e. the
last char is \n)
5. Notice that when you put the point on that last line, the face does not
appear. Now
uncomment (when (same-line-p b e) (decf b)), and notice that the overlay
does appear.
6. The same thing happens when the before-string property is set.
Expected behavior:
Either the overlay's face property affects the before and after strings, even
if the overlay would
otherwise be empty.
P.S. It would also be nice if hl-line-mode was changed to properly handle the
last line in a
buffer. ;)
-- MJF
In GNU Emacs 22.0.50.1 (i486-pc-linux-gnu, GTK+ Version 2.8.10)
of 2006-02-09 on pacem, modified by Debian
X server distributor `The X.Org Foundation', version 11.0.60900000
configured using `configure '--build' 'i486-linux-gnu' '--host'
'i486-linux-gnu' '--prefix=/usr' '--sharedstatedir=/var/lib'
'--libexecdir=/usr/lib' '--localstatedir=/var' '--infodir=/usr/share/info'
'--mandir=/usr/share/man' '--with-pop=yes'
'--enable-locallisppath=/etc/emacs-snapshot:/etc/emacs:/usr/local/share/emacs/22.0.50/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/22.0.50/site-lisp:/usr/share/emacs/site-lisp:/usr/share/emacs/22.0.50/leim'
'--with-x=yes' '--with-x-toolkit=gtk' 'CFLAGS=-DDEBIAN -g -Wno-pointer-sign
-O2' 'build_alias=i486-linux-gnu' 'host_alias=i486-linux-gnu''
Important settings:
value of $LC_ALL: nil
value of $LC_COLLATE: nil
value of $LC_CTYPE: nil
value of $LC_MESSAGES: nil
value of $LC_MONETARY: nil
value of $LC_NUMERIC: nil
value of $LC_TIME: nil
value of $LANG: nil
locale-coding-system: nil
default-enable-multibyte-characters: t
Major mode: Emacs-Lisp
Minor modes in effect:
eldoc-mode: t
global-balanced-mode: t
balanced-mode: t
iswitchb-mode: t
hrule-mode: t
cua-mode: t
global-reveal-mode: t
reveal-mode: t
global-hi-lock-mode: t
hi-lock-mode: t
show-paren-mode: t
auto-compression-mode: t
mouse-wheel-mode: t
menu-bar-mode: t
file-name-shadow-mode: t
global-font-lock-mode: t
font-lock-mode: t
blink-cursor-mode: t
unify-8859-on-encoding-mode: t
utf-translate-cjk-mode: t
column-number-mode: t
line-number-mode: t
transient-mark-mode: t
Recent input:
l i n e - p SPC b SPC e ) SPC ( d e c f SPC b ) ) <down>
<down> <down> C-x C-e <down> <down> <down> <down> <down>
<down> <left> <down> <down> <down> <down> <down> <down>
<down> <down> <down> <down> e o a u <backspace> <backspace>
<backspace> <backspace> <select-window> <help-echo>
<select-window> <select-window> <help-echo> C-x C-f
~ / . e m a c s e <backspace> . d / t e <tab> <return>
<down> <up> <down> <down> <down> <down> <M-right> <M-left>
M-SPC M-; <down> <end> C-x C-e C-x o C-x o <help-echo>
<help-echo> <help-echo> <help-echo> <menu-bar> <help-menu>
<report-emacs-bug>
Recent messages:
if: No immediate closing parenthesis [2 times]
hl-line-move
Auto-saving hl-line.el.gz: Opening output file: permission denied,
/usr/share/emacs/22.0.50/lisp/#hl-line.el.gz#
text.el has auto save data; consider M-x recover-this-file
Mark set
Loading newcomment...done
(lambda nil "Auto-generated by `hook-mode'")
Loading emacsbug...done
hl-line-move [2 times]
Undo!
- Empty Overlay with before-string or after-string property still treated as empty,
M Jared Finder <=