all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Max Mikhanosha <max@openchat.com>
To: emacs-devel@gnu.org
Subject: Re: BUG+patch: line-move-1 ignores buffer-invisibility-spec
Date: Wed, 31 Aug 2011 00:28:34 -0400	[thread overview]
Message-ID: <87pqjm19xp.wl%max@openchat.com> (raw)
In-Reply-To: <87r5421abs.wl%max@openchat.com>

Oops please disregard this bug report.

Apparently I had some really old piece of code (library called APEL)
loaded, which had a definition of (invisible-p) function in it, which ignored
the buffer-invisibility-spec.

At Wed, 31 Aug 2011 00:20:07 -0400,
Max Mikhanosha wrote:
> 
> I had started using egg (the fancy vc-git replacement) and had noticed
> that sometimes point jumps all over the place weirdly inside Egg
> buffers. For example pressing down arrow on the very first change in
> 500 line diff, would jump to the end of the buffer.
> 
> After debugging it, it seems that Egg is using unique 'invisible text
> property for every diff hunk text in the buffer, and sets
> `buffer-invisibility-spec' to nil initially. It has the command to
> show/hide diff hunks, which it accomplishes by adding/removing that
> hunk's unique 'invisible property value to `buffer-invisibility-spec'
> variable.
> 
> So far so good, but I was wondering why `next-line' function sometimes
> skips the text that is not hidden. After debugging it, much to my
> surprise, it appears that line-move-1 function in simple.el,
> completely ignores `buffer-invisibility-spec' and skips any text with
> non-NIL 'invisible property.
> 
> I had found the correct code to skip invisible text that takes
> `buffer-invisibility-spec' into account in the forward-visual-line
> function.
> 
> After changing the line-move-1 invisibility code to be the same, it had
> fixed my problem with point jumping erratically in Egg buffers.
> 
> This is for Emacs 23, but Emacs 24 simple.el appears to have the same
> problem.
> 
> Patch pasted below
> 
> === modified file 'lisp/simple.el'
> *** lisp/simple.el	2011-02-17 07:43:53 +0000
> --- lisp/simple.el	2011-08-31 03:51:26 +0000
> ***************
> *** 4254,4261 ****
>   	      (while (and (> arg 0) (not done))
>   		;; If the following character is currently invisible,
>   		;; skip all characters with that same `invisible' property value.
> ! 		(while (and (not (eobp)) (invisible-p (point)))
> ! 		  (goto-char (next-char-property-change (point))))
>   		;; Move a line.
>   		;; We don't use `end-of-line', since we want to escape
>   		;; from field boundaries occurring exactly at point.
> --- 4254,4272 ----
>   	      (while (and (> arg 0) (not done))
>   		;; If the following character is currently invisible,
>   		;; skip all characters with that same `invisible' property value.
> !                 (while (and (not (eobp))
> !                             (let ((prop
> !                                    (get-char-property (point) 'invisible)))
> !                               (if (eq buffer-invisibility-spec t)
> !                                   prop
> !                                 (or (memq prop buffer-invisibility-spec)
> !                                     (assq prop buffer-invisibility-spec)))))
> !                   (goto-char
> !                    (if (get-text-property (point) 'invisible)
> !                        (or (next-single-property-change (point) 'invisible)
> !                            (point-max))
> !                      (next-overlay-change (point)))))
> ! 
>   		;; Move a line.
>   		;; We don't use `end-of-line', since we want to escape
>   		;; from field boundaries occurring exactly at point.
> ***************
> *** 4309,4320 ****
>   		    (setq done t))))
>   		(unless done
>   		  (setq arg (1+ arg))
> ! 		  (while (and ;; Don't move over previous invis lines
> ! 			  ;; if our target is the middle of this line.
> ! 			  (or (zerop (or goal-column temporary-goal-column))
> ! 			      (< arg 0))
> ! 			  (not (bobp)) (invisible-p (1- (point))))
> ! 		    (goto-char (previous-char-property-change (point))))))))
>   	  ;; This is the value the function returns.
>   	  (= arg 0))
>   
> --- 4320,4337 ----
>   		    (setq done t))))
>   		(unless done
>   		  (setq arg (1+ arg))
> !                   (while (and (not (bobp))
> !                               (let ((prop
> !                                      (get-char-property (1- (point)) 'invisible)))
> !                                 (if (eq buffer-invisibility-spec t)
> !                                     prop
> !                                   (or (memq prop buffer-invisibility-spec)
> !                                       (assq prop buffer-invisibility-spec)))))
> !                     (goto-char
> !                      (if (get-text-property (1- (point)) 'invisible)
> !                          (or (previous-single-property-change (point) 'invisible)
> !                              (point-min))
> !                        (previous-overlay-change (point)))))))))
>   	  ;; This is the value the function returns.
>   	  (= arg 0))
>   
> ***************
> *** 4352,4360 ****
>   	     (save-excursion
>   	       ;; Like end-of-line but ignores fields.
>   	       (skip-chars-forward "^\n")
> ! 	       (while (and (not (eobp)) (invisible-p (point)))
> ! 		 (goto-char (next-char-property-change (point)))
> ! 		 (skip-chars-forward "^\n"))
>   	       (point))))
>   
>   	;; Move to the desired column.
> --- 4369,4387 ----
>   	     (save-excursion
>   	       ;; Like end-of-line but ignores fields.
>   	       (skip-chars-forward "^\n")
> !                (while (and (not (eobp))
> !                            (let ((prop
> !                                   (get-char-property (point) 'invisible)))
> !                              (if (eq buffer-invisibility-spec t)
> !                                  prop
> !                                (or (memq prop buffer-invisibility-spec)
> !                                    (assq prop buffer-invisibility-spec)))))
> !                  (goto-char
> !                   (if (get-text-property (point) 'invisible)
> !                       (or (next-single-property-change (point) 'invisible)
> !                           (point-max))
> !                     (next-overlay-change (point))))
> !                  (skip-chars-forward "^\n"))
>   	       (point))))
>   
>   	;; Move to the desired column.
> 
> 
> 



      reply	other threads:[~2011-08-31  4:28 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-31  4:20 BUG+patch: line-move-1 ignores buffer-invisibility-spec Max Mikhanosha
2011-08-31  4:28 ` Max Mikhanosha [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87pqjm19xp.wl%max@openchat.com \
    --to=max@openchat.com \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.