emacs-wiki-discuss
[Top][All Lists]
Advanced

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

[emacs-wiki-discuss] [PATCH] Fix mouse highlighting of extended links


From: Sergey Vlasov
Subject: [emacs-wiki-discuss] [PATCH] Fix mouse highlighting of extended links
Date: Tue, 30 Aug 2005 22:37:15 +0400

Hello!

GNU Emacs 21.3 seems to have problems with handling the `highlight'
text property on invisible text.  With emacs-wiki this gives a bad
visual effect when an extended link is placed at the beginning of
line.  E.g., try to display a wiki file with this contents:

[[Page1]]
[[Page2]]
[[Page3]]

Then if you move the mouse over one of these links, the end of the
previous line is highlighted together with the link, or, if such link
is at the first line of text, the highlighted text is shifted one
character to the left and sometimes is not redrawn properly after
highlighting is removed.

This looks like an Emacs bug, however, I have found a workaround - the
problem does not show up if the `highlight' property is not set on
invisible text.  To do this, two functions in emacs-wiki need to be
changed:

 * emacs-wiki-link-properties always includes ('mouse-face 'highlight)
   in the returned list - this part needs to be moved into the branch
   which handles the displayed text.  While doing that, I also moved
   ('rear-nonsticky t) to the common list, and killed redundant
   (emacs-wiki-keymap-property emacs-wiki-local-map) which was both in
   the common list and in the lists for displayed and invisible text.

 * Changing emacs-wiki-link-properties alone does not help, because
   emacs-wiki-highlight-extended-link puts properties for displayed
   link part also on invisible characters (and even has a comment
   about this).  However, I don't completely understand the purpose of
   this:

    * the keymap property is already set for both visible and
      invisible parts of the link (this is what really matters -
      following links needs to work when point appears to be inside
      the link text, even if it is somewhere in the invisible part);

    * the help-echo property is also set for both parts (although
      probably it does not matter for the invisible part);

    * the face property does not matter for the invisible text, and if
      that text becomes visible as a result of editing the link, it
      would be fontified again.

   Just to be on the safe side, I added the face property for the
   invisible text to duplicate the old behavior, but in my tests I did
   not notice any differences.  Probably that `append' could be
   removed.

The patch was tested only on GNU Emacs 21.3.

--- emacs-wiki/emacs-wiki-colors.el.link-properties     2005-08-10 22:49:35 
+0400
+++ emacs-wiki/emacs-wiki-colors.el     2005-08-30 11:02:09 +0400
@@ -789,12 +789,9 @@
 
 (defsubst emacs-wiki-link-properties (help-str &optional face point)
   (append (if face
-              (list 'face face 'rear-nonsticky t
-                    emacs-wiki-keymap-property emacs-wiki-local-map)
-            (list 'invisible 'emacs-wiki 'intangible t 'rear-nonsticky t
-                  emacs-wiki-keymap-property emacs-wiki-local-map))
-          (list 'mouse-face 'highlight
-                'help-echo help-str
+              (list 'face face 'mouse-face 'highlight)
+            (list 'invisible 'emacs-wiki 'intangible t))
+         (list 'help-echo help-str 'rear-nonsticky t
                 emacs-wiki-keymap-property emacs-wiki-local-map)))
 
 (defun emacs-wiki-link-face (link-name)
@@ -846,8 +843,8 @@
      (link
       (let* ((props (emacs-wiki-link-properties
                      link (emacs-wiki-link-face link) start))
-             (invis-props (append props (emacs-wiki-link-properties
-                                         link nil start))))
+             (invis-props (append (emacs-wiki-link-properties link nil start)
+                                 (list 'face (emacs-wiki-link-face link)))))
             (if desc
                 (progn
                   ;; we put the normal face properties on the

-- 
Sergey Vlasov

Attachment: pgpsWrm3RcFTB.pgp
Description: PGP signature


reply via email to

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