unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Scroll on save
       [not found] <20200713223521.jbjgmzyxxp2w45ot.ref@Ergus>
@ 2020-07-13 22:35 ` Ergus
  2020-07-13 22:38   ` Narendra Joshi
                     ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Ergus @ 2020-07-13 22:35 UTC (permalink / raw)
  To: help-gnu-emacs

Hi:

Recently I have observed that when I save long files (C-x C-s) (either
in a C file or Latex); for some reason emacs scrolls to some different
place in the buffer. I am pretty sure that it should has to do with my
config, but I don't know where to start looking for the problem.

Does anyone has an idea or similar experience in the past? Any help to
solve it will be fine.

Thanks in advance,
Ergus.




^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Scroll on save
  2020-07-13 22:35 ` Scroll on save Ergus
@ 2020-07-13 22:38   ` Narendra Joshi
  2020-07-13 22:39     ` Narendra Joshi
  2020-07-14 10:32     ` Ergus
  2020-07-13 23:00   ` Óscar Fuentes
  2020-07-14 16:54   ` Dmitry Alexandrov
  2 siblings, 2 replies; 9+ messages in thread
From: Narendra Joshi @ 2020-07-13 22:38 UTC (permalink / raw)
  To: Ergus; +Cc: Help Gnu Emacs mailing list

I would recommend that you check the values for after-save-hook and
before-save-hook.

On Tue, 14 Jul 2020, 00:35 Ergus, <spacibba@aol.com> wrote:

> Hi:
>
> Recently I have observed that when I save long files (C-x C-s) (either
> in a C file or Latex); for some reason emacs scrolls to some different
> place in the buffer. I am pretty sure that it should has to do with my
> config, but I don't know where to start looking for the problem.
>
> Does anyone has an idea or similar experience in the past? Any help to
> solve it will be fine.
>
> Thanks in advance,
> Ergus.
>
>
>


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Scroll on save
  2020-07-13 22:38   ` Narendra Joshi
@ 2020-07-13 22:39     ` Narendra Joshi
  2020-07-14 10:32     ` Ergus
  1 sibling, 0 replies; 9+ messages in thread
From: Narendra Joshi @ 2020-07-13 22:39 UTC (permalink / raw)
  To: Ergus; +Cc: Help Gnu Emacs mailing list

Checking the value of these hooks would reveal what code is being executed
when you save a file.

On Tue, 14 Jul 2020, 00:38 Narendra Joshi, <narendraj9@gmail.com> wrote:

> I would recommend that you check the values for after-save-hook and
> before-save-hook.
>
> On Tue, 14 Jul 2020, 00:35 Ergus, <spacibba@aol.com> wrote:
>
>> Hi:
>>
>> Recently I have observed that when I save long files (C-x C-s) (either
>> in a C file or Latex); for some reason emacs scrolls to some different
>> place in the buffer. I am pretty sure that it should has to do with my
>> config, but I don't know where to start looking for the problem.
>>
>> Does anyone has an idea or similar experience in the past? Any help to
>> solve it will be fine.
>>
>> Thanks in advance,
>> Ergus.
>>
>>
>>


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Scroll on save
  2020-07-13 22:35 ` Scroll on save Ergus
  2020-07-13 22:38   ` Narendra Joshi
@ 2020-07-13 23:00   ` Óscar Fuentes
  2020-07-14 10:34     ` Ergus
  2020-07-14 16:54   ` Dmitry Alexandrov
  2 siblings, 1 reply; 9+ messages in thread
From: Óscar Fuentes @ 2020-07-13 23:00 UTC (permalink / raw)
  To: help-gnu-emacs

Ergus <spacibba@aol.com> writes:

> Recently I have observed that when I save long files (C-x C-s) (either
> in a C file or Latex); for some reason emacs scrolls to some different
> place in the buffer. I am pretty sure that it should has to do with my
> config, but I don't know where to start looking for the problem.
>
> Does anyone has an idea or similar experience in the past? Any help to
> solve it will be fine.

Bisect your .emacs:

https://stackoverflow.com/questions/23772890/how-to-find-a-bug-in-emacs-or-init-el




^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Scroll on save
  2020-07-13 22:38   ` Narendra Joshi
  2020-07-13 22:39     ` Narendra Joshi
@ 2020-07-14 10:32     ` Ergus
  2020-07-14 16:13       ` Narendra Joshi
  1 sibling, 1 reply; 9+ messages in thread
From: Ergus @ 2020-07-14 10:32 UTC (permalink / raw)
  To: Narendra Joshi; +Cc: Help Gnu Emacs mailing list

This is weird, because both hooks are nil. And the problem starts
randomly after some time without apparent reason.

On Tue, Jul 14, 2020 at 12:38:05AM +0200, Narendra Joshi wrote:
>I would recommend that you check the values for after-save-hook and
>before-save-hook.
>
>On Tue, 14 Jul 2020, 00:35 Ergus, <spacibba@aol.com> wrote:
>
>> Hi:
>>
>> Recently I have observed that when I save long files (C-x C-s) (either
>> in a C file or Latex); for some reason emacs scrolls to some different
>> place in the buffer. I am pretty sure that it should has to do with my
>> config, but I don't know where to start looking for the problem.
>>
>> Does anyone has an idea or similar experience in the past? Any help to
>> solve it will be fine.
>>
>> Thanks in advance,
>> Ergus.
>>
>>
>>



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Scroll on save
  2020-07-13 23:00   ` Óscar Fuentes
@ 2020-07-14 10:34     ` Ergus
  2020-07-14 12:26       ` Tomas Nordin
  0 siblings, 1 reply; 9+ messages in thread
From: Ergus @ 2020-07-14 10:34 UTC (permalink / raw)
  To: Óscar Fuentes; +Cc: help-gnu-emacs

Hi Oscar:

I already tried that. The problem is that the problem starts after some
time editing. And I don't find a pattern to reproduce it in a systematic
way.



On Tue, Jul 14, 2020 at 01:00:29AM +0200, �scar Fuentes wrote:
>Ergus <spacibba@aol.com> writes:
>
>> Recently I have observed that when I save long files (C-x C-s) (either
>> in a C file or Latex); for some reason emacs scrolls to some different
>> place in the buffer. I am pretty sure that it should has to do with my
>> config, but I don't know where to start looking for the problem.
>>
>> Does anyone has an idea or similar experience in the past? Any help to
>> solve it will be fine.
>
>Bisect your .emacs:
>
>https://stackoverflow.com/questions/23772890/how-to-find-a-bug-in-emacs-or-init-el
>
>



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Scroll on save
  2020-07-14 10:34     ` Ergus
@ 2020-07-14 12:26       ` Tomas Nordin
  0 siblings, 0 replies; 9+ messages in thread
From: Tomas Nordin @ 2020-07-14 12:26 UTC (permalink / raw)
  To: Ergus, Óscar Fuentes; +Cc: help-gnu-emacs

Ergus <spacibba@aol.com> writes:

> Hi Oscar:
>
> I already tried that. The problem is that the problem starts after some
> time editing. And I don't find a pattern to reproduce it in a systematic
> way.
>

With no proof or recipe, I thought I experienced something similar. I'm
saving a lot and maybe it was connected to that, but my experience was
that when swapping buffers and coming back to one, point was on some
other location relative my memory. This was coming back to a Python
buffer and using Eglot. I somehow connected it to the LSP/xref things or
just me being confused.

--
Tomas



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Scroll on save
  2020-07-14 10:32     ` Ergus
@ 2020-07-14 16:13       ` Narendra Joshi
  0 siblings, 0 replies; 9+ messages in thread
From: Narendra Joshi @ 2020-07-14 16:13 UTC (permalink / raw)
  To: Ergus; +Cc: Help Gnu Emacs mailing list

Ergus <spacibba@aol.com> writes:

The next thing that I would try is using the command `profiler-start`
just before saving the buffer and then `profiler-report` after saving
the buffer to narrow your search down to a couple of functions that
might be causing this. I am not sure if this would actually help but
worth trying.

> This is weird, because both hooks are nil. And the problem starts
> randomly after some time without apparent reason.
>
> On Tue, Jul 14, 2020 at 12:38:05AM +0200, Narendra Joshi wrote:
>>I would recommend that you check the values for after-save-hook and
>>before-save-hook.
>>
>>On Tue, 14 Jul 2020, 00:35 Ergus, <spacibba@aol.com> wrote:
>>
>>> Hi:
>>>
>>> Recently I have observed that when I save long files (C-x C-s) (either
>>> in a C file or Latex); for some reason emacs scrolls to some different
>>> place in the buffer. I am pretty sure that it should has to do with my
>>> config, but I don't know where to start looking for the problem.
>>>
>>> Does anyone has an idea or similar experience in the past? Any help to
>>> solve it will be fine.
>>>
>>> Thanks in advance,
>>> Ergus.
>>>
>>>
>>>
>

-- 
Narendra Joshi



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Scroll on save
  2020-07-13 22:35 ` Scroll on save Ergus
  2020-07-13 22:38   ` Narendra Joshi
  2020-07-13 23:00   ` Óscar Fuentes
@ 2020-07-14 16:54   ` Dmitry Alexandrov
  2 siblings, 0 replies; 9+ messages in thread
From: Dmitry Alexandrov @ 2020-07-14 16:54 UTC (permalink / raw)
  To: Ergus; +Cc: help-gnu-emacs

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

Ergus <spacibba@aol.com> wrote:
> when I save long files (C-x C-s); for some reason emacs scrolls to some different place in the buffer. I am pretty sure that it should has to do with my config, but I don't know where to start looking for the problem.

	(defvar movement-primitives '(forward-comment re-search-backward goto-char move-to-column vertical-motion skip-syntax-backward search-forward backward-prefix-chars recenter forward-word skip-chars-forward forward-line re-search-forward end-of-line set-window-hscroll posix-search-forward move-to-window-line skip-syntax-forward search-backward backward-char posix-search-backward set-window-start beginning-of-line skip-chars-backward search-forward-regexp move-point-visually search-backward-regexp forward-char set-window-point)
	  "C primitives that can move a point yet not edit the buffer (I hope I enumerated them all)")
	
	(advice-add #'basic-save-buffer-1       ; before-save-hook is too early
	            :after
	            (lambda ()
	              (mapc #'debug-on-entry movement-primitives)))
	
	(add-hook 'after-save-hook #'cancel-debug-on-entry)

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 247 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2020-07-14 16:54 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20200713223521.jbjgmzyxxp2w45ot.ref@Ergus>
2020-07-13 22:35 ` Scroll on save Ergus
2020-07-13 22:38   ` Narendra Joshi
2020-07-13 22:39     ` Narendra Joshi
2020-07-14 10:32     ` Ergus
2020-07-14 16:13       ` Narendra Joshi
2020-07-13 23:00   ` Óscar Fuentes
2020-07-14 10:34     ` Ergus
2020-07-14 12:26       ` Tomas Nordin
2020-07-14 16:54   ` Dmitry Alexandrov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).