From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Joe Wells Newsgroups: gmane.emacs.bugs Subject: Re: anomalies of overlays and before-string and display properties Date: Wed, 19 Sep 2007 14:27:22 +0100 Message-ID: <86lkb2bxad.fsf@macs.hw.ac.uk> References: <86ps0ebxps.fsf@macs.hw.ac.uk> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: sea.gmane.org 1190208957 13804 80.91.229.12 (19 Sep 2007 13:35:57 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 19 Sep 2007 13:35:57 +0000 (UTC) To: bug-gnu-emacs@gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Sep 19 15:35:43 2007 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1IXzgw-000283-Kd for geb-bug-gnu-emacs@m.gmane.org; Wed, 19 Sep 2007 15:34:11 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IXzgu-0001Qs-QZ for geb-bug-gnu-emacs@m.gmane.org; Wed, 19 Sep 2007 09:34:08 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1IXzaQ-0006sL-GD for bug-gnu-emacs@gnu.org; Wed, 19 Sep 2007 09:27:26 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1IXzaP-0006rw-SV for bug-gnu-emacs@gnu.org; Wed, 19 Sep 2007 09:27:26 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IXzaP-0006rr-ID for bug-gnu-emacs@gnu.org; Wed, 19 Sep 2007 09:27:25 -0400 Original-Received: from izanami.macs.hw.ac.uk ([137.195.13.6]) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1IXzaO-0004ZD-Gf for bug-gnu-emacs@gnu.org; Wed, 19 Sep 2007 09:27:24 -0400 Original-Received: from lxultra1.macs.hw.ac.uk ([137.195.27.173]:48826 helo=127.0.0.1) by izanami.macs.hw.ac.uk with smtp (Exim 4.51) id 1IXzaN-0006OY-5h for bug-gnu-emacs@gnu.org; Wed, 19 Sep 2007 14:27:23 +0100 Original-Received: (nullmailer pid 14097 invoked by uid 1001); Wed, 19 Sep 2007 13:27:22 -0000 In-Reply-To: <86ps0ebxps.fsf@macs.hw.ac.uk> (Joe Wells's message of "Wed\, 19 Sep 2007 14\:18\:07 +0100") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1 (gnu/linux) X-Detected-Kernel: Linux 2.6, seldom 2.4 (older, 4) X-BeenThere: bug-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:16575 Archived-At: By the way, with one exception, these problems also occur with after-string properties. The exception is that the overlay's mouse-face property does correctly cover both the overlays display and after-string properties. This is more evidence that not covering the before-string property is a bug. Strangely, the after-string also =E2=80=9Cinherits=E2=80=9D face attributes= from the character after the beginning of the overlay, not the character just before the _end_ of the overlay. This is more evidence that this is a bug and not a feature. Joe Joe Wells writes: > There are a number of strange anomalies (some clearly bugs) in the > behavior of overlays and before-string and display properties. > > 1. Faces on a display property on a before-string behave differently > depending on where the display property is in the before-string. > For a display property at the beginning of the before-string, its > face is used and the before-string's face is ignored (I think this > is correct). For a display property not at the beginning of the > before-string, its face is completely ignored, and the face of the > before-string is used instead. This is fairly clearly a bug. > > 2. When a substring of a before-string beginning at offset O has a > display property which is a string S, the first O characters of S > are not displayed. If S is not at least O+1 characters long, then > disastrous things start to happen. This is clearly a bug. > > 3. The before-string somehow =E2=80=9Cinherits=E2=80=9D face attributes f= rom the face > of the character that follows the start of the overlay. (If the > overlay is of length zero, this character is not even in the > overlay. See the recent discussion of how this problem is > affecting linum.el.) This means that in practice a before-string > needs to use completely specified faces, which is obviously a real > pain. > > 4. The display property of an overlay somehow =E2=80=9Cinherits=E2=80=9D = face > attributes from the face of the character that follows the start of > the overlay. This has similar disadvantages to anomaly #3 > mentioned above. > > 5. The help-echo and mouse-face properties of an overlay with both a > before-string and a display property only affect the material > displayed by the overlay's display property. One can work around > the issue by copying these properties to the various display > properties inside the before-string; however, this workaround is a > pain and in the case of mouse-face it doesn't get the entire > overlay highlighted at once but instead only the pieces are > highlighted one at a time. It would be nice to be able to set a > single help-echo or a single mouse-face property that would affect > the _entire_ overlay. > > You can reproduce all of these anomalies with this function: > > (defun illustrate-anomalies () > (let ((s #1=3D#("\\abcd{VWXYZ}" > 0 5 (face (:foreground "Purple" :background "yellow")) > 5 12 > (face > (:foreground > "DarkOliveGreen" > :weight bold :slant oblique :height 0.8)))) > (props > '(help-echo > #1# > ;;face (:slant italic :foreground "red") > display "]" > before-string > #(" " > 0 1 > (display > #("|[" > 0 2 (;; help-echo #1# > face #2=3D(:strike-through t :background "white"))) > ;; help-echo #1# > face #3=3D(:underline t)) > 1 2 > (display > #("||VWXYZ" > 0 7 (;; help-echo #1# > ;; mouse-face (:background "darkseagreen2") > face #2#)) > ;; help-echo #1# > face #3#)) > mouse-face (:background "darkseagreen2"))) > (buf (get-buffer-create "xyzzy"))) > (with-current-buffer buf > (display-buffer buf) > (erase-buffer) > (dolist (o (overlays-in (point-min) (point-max))) > (delete-overlay o)) > (insert s) > (let ((o (make-overlay (point-min) (point-max)))) > (while props > (overlay-put o (car props) (cadr props)) > (setq props (nthcdr 2 props))))))) > > This example is derived from some work where I was trying to get > AUCTeX's folding mode to show the fontified and latex-previewed > contents of macro arguments. > > I hope this problem report is useful. > > Joe > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > In GNU Emacs 22.1.1 (i686-pc-linux-gnu, GTK+ Version 2.8.20) > of 2007-06-27 on artemis > Windowing system distributor `The X.Org Foundation', version 11.0.70000000 > configured using `configure '--prefix=3D/home/jbw/local2' '--enable-debu= g' '--disable-nls' '--with-x-toolkit=3Dgtk' 'CFLAGS=3D-O0 -g3 -ggdb'' > > Important settings: > value of $LC_ALL: nil > value of $LC_COLLATE: nil > value of $LC_CTYPE: en_US.UTF-8 > value of $LC_MESSAGES: nil > value of $LC_MONETARY: nil > value of $LC_NUMERIC: nil > value of $LC_TIME: jbw > value of $LANG: nil > locale-coding-system: utf-8 > default-enable-multibyte-characters: t > > Minor modes in effect: > outline-minor-mode: t > desktop-save-mode: t > url-handler-mode: t > tooltip-mode: t > mouse-wheel-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 > auto-compression-mode: t > temp-buffer-resize-mode: t > size-indication-mode: t > line-number-mode: t > transient-mark-mode: t