From: Barry OReilly <gundaetiapo@gmail.com>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: 15045@debbugs.gnu.org, David Engster <deng@randomsample.de>,
Eric Ludlam <eric@siege-engine.com>
Subject: bug#15045: Point jumps inappropriately around time of Semantic lexing
Date: Fri, 25 Oct 2013 15:15:48 -0400 [thread overview]
Message-ID: <CAFM41H2M1Do7_5zA5i2VQPXrdz7ou7jUVTi=i81-qfBcTwQo1A@mail.gmail.com> (raw)
In-Reply-To: <CAFM41H1cyJyPDt8KCrFGMDb5cEAxgtzWmDz0GaJg13vQKYg1zQ@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 3253 bytes --]
In terms of solving the issue of how Semantic calls
accept-process-output, here are two proposals:
1: Per David Engster:
> If you look in the `define-lex' macro, you see that it calls
> `semantic-throw-on-input' after each identified token. The problem is
> that it does not restore the cursor position before that, so I guess the
> fix is simply to change this call to
>
> (save-excursion
> (goto-char starting-position)
> (semantic-throw-on-input 'lex))
Here's a patch to implement the basic idea. My debugging indicates
accept-process-output can be called when lexing other buffers, so I
saved off the marker rather than just position.
That said, I have never personally witnessed point unexpectedly
redisplayed in another buffer -- only within the same buffer. That
could be a consequence of how it interacts with the
jit-lock-deferred-fontify idle timer. (I have confirmed with my debug
statements that Semantic is the outer timer and
jit-lock-deferred-fontify is the inner timer which redisplays.)
Please let me know if this fix is suitable.
diff --git a/lisp/cedet/semantic/fw.el b/lisp/cedet/semantic/fw.el
index 825cdc9..869d183 100644
--- a/lisp/cedet/semantic/fw.el
+++ b/lisp/cedet/semantic/fw.el
@@ -369,6 +369,8 @@ later installation should be done in MODE hook."
;;
(defvar semantic-current-input-throw-symbol nil
"The current throw symbol for `semantic-exit-on-input'.")
+(defvar semantic--on-input-start-marker nil
+ "The marker when starting a semantic-exit-on-input form.")
(defmacro semantic-exit-on-input (symbol &rest forms)
"Using SYMBOL as an argument to `throw', execute FORMS.
@@ -376,7 +378,8 @@ If FORMS includes a call to `semantic-throw-on-input',
then
if a user presses any key during execution, this form macro
will exit with the value passed to `semantic-throw-on-input'.
If FORMS completes, then the return value is the same as `progn'."
- `(let ((semantic-current-input-throw-symbol ,symbol))
+ `(let ((semantic-current-input-throw-symbol ,symbol)
+ (semantic--on-input-start-marker (point-marker)))
(catch ,symbol
,@forms)))
(put 'semantic-exit-on-input 'lisp-indent-function 1)
@@ -387,7 +390,16 @@ FROM is an indication of where this function is called
from as a value
to pass to `throw'. It is recommended to use the name of the function
calling this one."
`(when (and semantic-current-input-throw-symbol
- (or (input-pending-p) (accept-process-output)))
+ (or (input-pending-p)
+ (save-excursion
+ ;; Timers might run during accept-process-output.
+ ;; If they redisplay, point must be where the user
+ ;; expects. (Bug#15045)
+ (set-buffer (marker-buffer
+ semantic--on-input-start-marker))
+ (goto-char (marker-position
+ semantic--on-input-start-marker))
+ (accept-process-output))))
(throw semantic-current-input-throw-symbol ,from)))
^L
2: Extend accept-process-output to allow suppressing timer_check.
Actually, there's an input arg already for that, but only applicable
if the PROCESS arg is non nil.
[-- Attachment #2: Type: text/html, Size: 3646 bytes --]
next prev parent reply other threads:[~2013-10-25 19:15 UTC|newest]
Thread overview: 76+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-08-07 17:59 bug#15045: Point jumps inappropriately around time of Semantic lexing Barry OReilly
2013-08-07 18:30 ` Stefan Monnier
2013-08-07 18:42 ` David Engster
2013-08-07 19:31 ` Barry OReilly
2013-08-07 19:44 ` Eli Zaretskii
2013-08-07 20:39 ` Barry OReilly
2013-08-08 2:41 ` Eli Zaretskii
2013-08-08 17:07 ` Barry OReilly
2013-08-08 17:46 ` Eli Zaretskii
2013-08-07 21:23 ` Stefan Monnier
2013-08-08 17:21 ` David Engster
2013-08-08 18:06 ` Stefan Monnier
2013-08-08 18:13 ` David Engster
2013-08-08 21:39 ` Eli Zaretskii
2013-08-08 22:51 ` Stefan Monnier
2013-08-09 7:56 ` Eli Zaretskii
2013-08-09 14:03 ` Stefan Monnier
2013-08-09 14:16 ` Eli Zaretskii
2013-08-09 17:34 ` Stefan Monnier
2013-08-09 18:23 ` Eli Zaretskii
2013-08-08 20:03 ` Barry OReilly
2013-08-08 20:30 ` David Engster
2013-08-08 21:49 ` Eli Zaretskii
2013-08-09 5:36 ` David Engster
2013-08-09 7:53 ` Eli Zaretskii
2013-08-09 11:50 ` Eric M. Ludlam
2013-08-09 13:31 ` Eli Zaretskii
2013-08-09 14:04 ` Stefan Monnier
2013-08-09 14:19 ` Eli Zaretskii
2013-08-09 18:08 ` Stefan Monnier
2013-08-09 18:38 ` Eli Zaretskii
2013-08-09 18:41 ` David Engster
2013-08-09 20:49 ` Eli Zaretskii
2013-08-09 21:36 ` Stefan Monnier
2013-08-10 9:42 ` David Engster
2013-08-09 21:46 ` Stefan Monnier
2013-08-09 16:10 ` David Engster
2013-08-09 18:31 ` Eli Zaretskii
2013-08-10 9:54 ` David Engster
2013-08-10 10:22 ` Eli Zaretskii
2013-08-10 18:06 ` Barry OReilly
2013-10-14 19:32 ` Barry OReilly
2013-10-14 19:51 ` Eli Zaretskii
2013-10-15 13:42 ` Stefan Monnier
2013-10-15 14:12 ` Barry OReilly
2013-10-15 16:28 ` Eli Zaretskii
2013-10-15 17:08 ` Barry OReilly
2013-10-15 18:48 ` Eli Zaretskii
2013-10-15 19:19 ` Barry OReilly
2013-10-16 2:57 ` Stefan Monnier
2013-10-16 14:57 ` Barry OReilly
2013-10-16 17:50 ` Stefan Monnier
2013-10-16 18:32 ` Barry OReilly
2013-10-17 15:03 ` Barry OReilly
2013-10-17 18:18 ` Stefan Monnier
2013-10-17 20:01 ` Barry OReilly
2013-10-18 0:27 ` Stefan Monnier
2013-10-18 14:03 ` Barry OReilly
2013-10-25 19:15 ` Barry OReilly [this message]
2013-11-14 18:21 ` Barry OReilly
2013-11-16 4:14 ` Stefan Monnier
2013-11-16 4:54 ` Barry OReilly
2013-11-16 17:37 ` Stefan Monnier
2013-11-16 20:33 ` Barry OReilly
2013-11-16 21:29 ` Stefan Monnier
2013-08-09 18:50 ` Stefan Monnier
2013-08-09 9:12 ` martin rudalics
2013-08-09 16:27 ` David Engster
2013-08-09 17:10 ` martin rudalics
2013-08-09 18:51 ` Stefan Monnier
2013-08-08 21:26 ` Stefan Monnier
2013-08-08 21:57 ` Eli Zaretskii
2013-08-08 22:50 ` Stefan Monnier
2013-08-09 7:54 ` Eli Zaretskii
2013-08-08 21:47 ` Eli Zaretskii
2013-08-09 3:26 ` Eric M. Ludlam
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='CAFM41H2M1Do7_5zA5i2VQPXrdz7ou7jUVTi=i81-qfBcTwQo1A@mail.gmail.com' \
--to=gundaetiapo@gmail.com \
--cc=15045@debbugs.gnu.org \
--cc=deng@randomsample.de \
--cc=eric@siege-engine.com \
--cc=monnier@iro.umontreal.ca \
/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.