all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Ren Victor <victorhge@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 30823@debbugs.gnu.org
Subject: bug#30823: 25.3; modification-hooks of overlays are not run in some cases
Date: Thu, 15 Mar 2018 15:29:52 +0800	[thread overview]
Message-ID: <CAMks0JERFxhRh4CYi0p38Pw=0_3bxrBOQ=Prh=QyG4+L=1Q1pg@mail.gmail.com> (raw)
In-Reply-To: <83lgetri7r.fsf@gnu.org>

[-- Attachment #1: Type: text/plain, Size: 1227 bytes --]

On Thu, Mar 15, 2018 at 2:00 PM, Eli Zaretskii <eliz@gnu.org> wrote:
>> From: Ren Victor <victorhge@gmail.com>
>> Date: Thu, 15 Mar 2018 12:15:57 +0800
>>
>> Two factors:
>>
>>    1.  A commit of Emacs, modification-hooks might not be run in some cases:
>>     http://git.savannah.gnu.org/cgit/emacs.git/commit/src?id=564d811725596f15ecf543777e11504b47d2af86
>>
>>    2.  In ggtags, an overlay is deleted in the overlay's modification-hooks:
>>     https://github.com/leoliu/ggtags/blob/eec392d2d639030c5a51bce8431f2815ad8e7bc5/ggtags.el#L2306
>>
>> Deleted overlay ceases to be attached to the buffer. If the buffer of
>> the first overlay in the saved array doesn't match the current buffer,
>> then all the modification hooks will not be run in this buffer.
>>
>> Thus modes that depends on modification-hooks won't work together with
>> ggtags-highlight-tag mode.
>>
>> I think Emacs should support `delete-overlay' in modificaiton-hooks of
>> overlays, like ggtags.  So I report this bug.
>
> Thanks.  Can you provide a recipe starting from "emacs -Q" to
> reproduce the problem?

I wrote a ert case which is encolsed.

emacs -Q -batch -l ert -l bug30823.el -f ert-run-tests-batch-and-exit

[-- Attachment #2: bug30823.el --]
[-- Type: text/x-emacs-lisp, Size: 604 bytes --]

(require 'ert)

(ert-deftest test-modification-hooks ()
  "Test for bug#30823."
  (let ((check-point nil)
	(ov-delete nil)
	(ov-set nil))
    (with-temp-buffer
      (insert "abc")
      (setq ov-set (make-overlay 1 3))
      (overlay-put ov-set 'modification-hooks
		   (list (lambda (o after &rest _args)
			   (and after (setq check-point t)))))
      (setq ov-delete (make-overlay 1 3))
      (overlay-put ov-delete 'modification-hooks
		   (list (lambda (o after &rest _args)
			   (and (not after) (delete-overlay o)))))
      (goto-char 2)
      (insert "1")
      (should (eq check-point t)))))


  reply	other threads:[~2018-03-15  7:29 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-15  4:15 bug#30823: 25.3; modification-hooks of overlays are not run in some cases Ren Victor
2018-03-15  6:00 ` Eli Zaretskii
2018-03-15  7:29   ` Ren Victor [this message]
2018-03-31 13:51     ` Noam Postavsky
2018-08-17 20:52       ` Noam Postavsky
2018-08-18  6:49         ` Eli Zaretskii
2018-08-19  3:48           ` Stefan Monnier
2018-08-19 14:46             ` Eli Zaretskii
2018-08-19 15:43               ` Stefan Monnier
2018-08-19 16:13                 ` Eli Zaretskii
2018-08-20  3:02                 ` Richard Stallman
2018-08-20 16:37                   ` Eli Zaretskii
2018-08-19 20:46           ` Stefan Monnier
2018-08-20 16:34             ` Eli Zaretskii
2018-08-23 12:13           ` Noam Postavsky
2018-08-23 13:57             ` Eli Zaretskii
2018-08-31  3:14               ` Noam Postavsky
2018-08-31 14:25                 ` Eli Zaretskii
2018-09-01 16:38                   ` Noam Postavsky
2018-09-11 11:59                     ` Eli Zaretskii
2018-09-13  1:34                       ` Noam Postavsky
2018-09-13 13:43                         ` Eli Zaretskii
2018-09-14 12:03                           ` Noam Postavsky
2018-09-15  9:23                             ` Eli Zaretskii
2018-09-15 14:10                               ` Noam Postavsky

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='CAMks0JERFxhRh4CYi0p38Pw=0_3bxrBOQ=Prh=QyG4+L=1Q1pg@mail.gmail.com' \
    --to=victorhge@gmail.com \
    --cc=30823@debbugs.gnu.org \
    --cc=eliz@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.