emacs-devel
[Top][All Lists]
Advanced

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

Re: A few questions about occur-mode


From: John Paul Wallington
Subject: Re: A few questions about occur-mode
Date: Mon, 23 Sep 2002 21:53:52 +0100
User-agent: Gnus/5.090008 (Oort Gnus v0.08) Emacs/21.3.50 (i686-pc-linux-gnu)

Juanma Barranquero <address@hidden> wrote:

> because otherwise there could be problems with matches at the end of a
> line. This leaves the point at the beginning of a match after M-n or M-p,
> but that seems preferable IMHO.
>
> Opinions?

If we put `occur-point' properties in `occur-engine' output because
of compatibility maybe they should go at the end of each match for
the same reason?   We could acomplish that by sticking a space on the
end of each line's string before propertizing it:

Index: replace.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/replace.el,v
retrieving revision 1.159
diff -u -r1.159 replace.el
*** replace.el  18 Sep 2002 16:03:58 -0000      1.159
--- replace.el  23 Sep 2002 20:46:42 -0000
***************
*** 804,811 ****
                    (setq lines (+ lines (1- (count-lines origpt endpt))))
                    (setq marker (make-marker))
                    (set-marker marker matchbeg)
!                   (setq curstring (buffer-substring begpt
!                                                     (line-end-position)))
                    ;; Depropertize the string, and maybe
                    ;; highlight the matches
                    (let ((len (length curstring))
--- 804,813 ----
                    (setq lines (+ lines (1- (count-lines origpt endpt))))
                    (setq marker (make-marker))
                    (set-marker marker matchbeg)
!                   (setq curstring (concat
!                                    (buffer-substring begpt
!                                                      (line-end-position))
!                                    " "))
                    ;; Depropertize the string, and maybe
                    ;; highlight the matches
                    (let ((len (length curstring))
***************
*** 821,826 ****
--- 823,834 ----
                                              (when match-face
                                                `(font-lock-face ,match-face)))
                                             curstring)
+                       ;; `occur-point' property is used by occur-next and
+                       ;; occur-prev to move between matches.
+                       (put-text-property (match-end 0)
+                                          (1+ (match-end 0))
+                                          'occur-point t 
+                                          curstring)
                        (setq start (match-end 0))))
                    ;; Generate the string to insert for this match
                    (let* ((out-line

-- 
John Paul Wallington




reply via email to

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