emacs-devel
[Top][All Lists]
Advanced

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

Re: follow-link not on mouse-face


From: Romain Francoise
Subject: Re: follow-link not on mouse-face
Date: Sun, 23 Oct 2005 12:19:42 +0200

"Richard M. Stallman" <address@hidden> writes:

> The change you described about context lines does not solve the
> problem, as I understand the problem.  I thought the problem was about
> the line numbers on match lines.

It's the same problem, line numbers and context lines are both zones
without mouse-face=highlight where a mouse-1 click will have an action.
The current CVS code does this:

  +--------------------+--------------------+--------------------+
  |          Line part |                    |                    |
  |                    |     Line number    |     Match data     |
  | Line type          |                    |                    |
  +--------------------+--------------------+--------------------+
  |                    |   highlight: N     |    highlight: N    |
  |    Context line    |     mouse-1: Y     |      mouse-1: Y    |
  |                    |     mouse-2: Y     |      mouse-2: Y    |
  +--------------------+--------------------+--------------------+
  |                    |   highlight: N     |    highlight: Y    |
  |     Match line     |     mouse-1: Y     |      mouse-1: Y    |
  |                    |     mouse-2: Y     |      mouse-2: Y    |
  +--------------------+--------------------+--------------------+

I see why you would want to treat the line number margin separately from
context lines.  How about adding a mouse-face=highlight property on line
numbers associated with match lines as well?  This way the whole match
line highlights and reacts to clicks, and context lines (including the
line number margin) have no special properties.  When there's no
context, all lines in the Occur buffer are links, and you can set point
with a long mouse-1 click, as with all links.  It seems natural.

This patch implements the following scheme:

  +--------------------+--------------------+--------------------+
  |          Line part |                    |                    |
  |                    |     Line number    |     Match data     |
  | Line type          |                    |                    |
  +--------------------+--------------------+--------------------+
  |                    |   highlight: N     |    highlight: N    |
  |    Context line    |     mouse-1: N     |      mouse-1: N    |
  |                    |     mouse-2: N     |      mouse-2: N    |
  +--------------------+--------------------+--------------------+
  |                    |   highlight: Y     |    highlight: Y    |
  |     Match line     |     mouse-1: Y     |      mouse-1: Y    |
  |                    |     mouse-2: Y     |      mouse-2: Y    |
  +--------------------+--------------------+--------------------+

Index: lisp/replace.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/replace.el,v
retrieving revision 1.225
diff -c -r1.225 replace.el
*** lisp/replace.el     20 Oct 2005 16:53:10 -0000      1.225
--- lisp/replace.el     23 Oct 2005 09:58:57 -0000
***************
*** 1129,1139 ****
                                    (append
                                     (when prefix-face
                                       `(font-lock-face prefix-face))
!                                    '(occur-prefix t)))
                             ;; We don't put `mouse-face' on the newline,
                             ;; because that loses.  And don't put it
                             ;; on context lines to reduce flicker.
!                            (propertize curstring 'mouse-face 'highlight)
                             "\n"))
                           (data
                            (if (= nlines 0)
--- 1129,1145 ----
                                    (append
                                     (when prefix-face
                                       `(font-lock-face prefix-face))
!                                    `(occur-prefix t mouse-face highlight
!                                      occur-target ,marker follow-link t
!                                      help-echo "mouse-2: go to this 
occurrence")))
                             ;; We don't put `mouse-face' on the newline,
                             ;; because that loses.  And don't put it
                             ;; on context lines to reduce flicker.
!                            (propertize curstring 'mouse-face 'highlight
!                                        'occur-target marker
!                                        'follow-link t
!                                        'help-echo
!                                        "mouse-2: go to this occurrence")
                             "\n"))
                           (data
                            (if (= nlines 0)
***************
*** 1154,1164 ****
                        (let ((beg (point))
                              (end (progn (insert data) (point))))
                          (unless (= nlines 0)
!                           (insert "-------\n"))
!                         (add-text-properties
!                          beg end
!                          `(occur-target ,marker follow-link t
!                                         help-echo "mouse-2: go to this 
occurrence")))))
                    (goto-char endpt))
                  (if endpt
                      (progn
--- 1160,1166 ----
                        (let ((beg (point))
                              (end (progn (insert data) (point))))
                          (unless (= nlines 0)
!                           (insert "-------\n")))))
                    (goto-char endpt))
                  (if endpt
                      (progn
-- 
Romain Francoise <address@hidden> | I just thought I'd go out
it's a miracle -- http://orebokech.com/ | with a little bit more style.




reply via email to

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