all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* emacs 24 problem: `revert` command forgets bindings from `occur` buffer for compressed files.
@ 2012-07-10  7:35 Paul K
  2012-07-10  8:07 ` Tassilo Horn
  0 siblings, 1 reply; 6+ messages in thread
From: Paul K @ 2012-07-10  7:35 UTC (permalink / raw)
  To: help-gnu-emacs

Hallo Emacs Users.

Steps to reproduce:
1) visit some compressed file, for example: /tmp/file.txt.bz2
2) M-x occur: `on some string that exisits in the file`
3) visit line with string metched by pressing <ENTER> in `occur` buffer
4) modify contents of file.txt.bz2, but do not save it.
5) M-x revert-buffer. Answer Yes.
    This action probably forgets all the pointers within file.txt.bz2
buffer, even `point`.
6) go back to `occur` buffer and try to visit the same line again:
EMACS JUMPS TO LAST LINE WITHIN file.txt.bz2.

Is it a bug?

best regards,
Paul



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

* Re: emacs 24 problem: `revert` command forgets bindings from `occur` buffer for compressed files.
  2012-07-10  7:35 emacs 24 problem: `revert` command forgets bindings from `occur` buffer for compressed files Paul K
@ 2012-07-10  8:07 ` Tassilo Horn
  2012-07-20 10:23   ` Paul K
  0 siblings, 1 reply; 6+ messages in thread
From: Tassilo Horn @ 2012-07-10  8:07 UTC (permalink / raw)
  To: help-gnu-emacs

Paul K <mafeuser@gmail.com> writes:

Hi Paul,

> Steps to reproduce:
> 1) visit some compressed file, for example: /tmp/file.txt.bz2
> 2) M-x occur: `on some string that exisits in the file`
> 3) visit line with string metched by pressing <ENTER> in `occur` buffer
> 4) modify contents of file.txt.bz2, but do not save it.
> 5) M-x revert-buffer. Answer Yes.
>     This action probably forgets all the pointers within file.txt.bz2
> buffer, even `point`.
> 6) go back to `occur` buffer and try to visit the same line again:
> EMACS JUMPS TO LAST LINE WITHIN file.txt.bz2.
>
> Is it a bug?

Not really a bug.  Occur uses markers in the "occured" buffer to specify
the match locations instead of line/colum numbers, and the links in the
*occur* buffer target those markers.  Thus, when you edit the buffer,
i.e., add or remove lines, the links are still valid for the occurences
that were already there before and haven't been removed by your editing,
because the markers are attached to the matched text and thus move
appropriately.

However, if you revert the buffer so that the file is found again, there
are no markers anymore.  When you click a link in the old *occur*
buffer, Emacs will try to find the given marker but fail, and thus point
ends up at the end of the buffer.

Bye,
Tassilo




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

* Re: emacs 24 problem: `revert` command forgets bindings from `occur` buffer for compressed files.
  2012-07-10  8:07 ` Tassilo Horn
@ 2012-07-20 10:23   ` Paul K
  2012-07-20 21:49     ` Tassilo Horn
  0 siblings, 1 reply; 6+ messages in thread
From: Paul K @ 2012-07-20 10:23 UTC (permalink / raw)
  To: Tassilo Horn; +Cc: help-gnu-emacs

Hallo Tassilo


> However, if you revert the buffer so that the file is found again, there
> are no markers anymore.

not true

> When you click a link in the old *occur*
> buffer, Emacs will try to find the given marker but fail, and thus point
> ends up at the end of the buffer.

for not compressed files, revert keeps markers in buffer, so that You
can use "old" *Occur* buffer.

best regards,
Paul



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

* Re: emacs 24 problem: `revert` command forgets bindings from `occur` buffer for compressed files.
  2012-07-20 10:23   ` Paul K
@ 2012-07-20 21:49     ` Tassilo Horn
  2012-07-24  8:30       ` Paul K
  0 siblings, 1 reply; 6+ messages in thread
From: Tassilo Horn @ 2012-07-20 21:49 UTC (permalink / raw)
  To: Paul K; +Cc: help-gnu-emacs

Paul K <mafeuser@gmail.com> writes:

>> However, if you revert the buffer so that the file is found again,
>> there are no markers anymore.
>
> not true
>
>> When you click a link in the old *occur* buffer, Emacs will try to
>> find the given marker but fail, and thus point ends up at the end of
>> the buffer.
>
> for not compressed files, revert keeps markers in buffer, so that You
> can use "old" *Occur* buffer.

Yes, `insert-file-contents' (which is the primitive used by
`revert-buffer') does indeed some clever things to ensure that only the
parts of the buffer that are different from the corresponding file are
replaced.  That keeps markers in the unchanged parts intact.

However, with compressed files the file contents and the buffer contents
are completely different, thus everything's replaced.

Bye,
Tassilo



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

* Re: emacs 24 problem: `revert` command forgets bindings from `occur` buffer for compressed files.
  2012-07-20 21:49     ` Tassilo Horn
@ 2012-07-24  8:30       ` Paul K
  2012-07-24  8:42         ` Tassilo Horn
  0 siblings, 1 reply; 6+ messages in thread
From: Paul K @ 2012-07-24  8:30 UTC (permalink / raw)
  To: Tassilo Horn; +Cc: help-gnu-emacs

but it also forgets the (point), thus it looks like at least overlook
if not a bug.

best regards,
Paul

On Fri, Jul 20, 2012 at 11:49 PM, Tassilo Horn <tassilo@member.fsf.org> wrote:
> Paul K <mafeuser@gmail.com> writes:
>
>>> However, if you revert the buffer so that the file is found again,
>>> there are no markers anymore.
>>
>> not true
>>
>>> When you click a link in the old *occur* buffer, Emacs will try to
>>> find the given marker but fail, and thus point ends up at the end of
>>> the buffer.
>>
>> for not compressed files, revert keeps markers in buffer, so that You
>> can use "old" *Occur* buffer.
>
> Yes, `insert-file-contents' (which is the primitive used by
> `revert-buffer') does indeed some clever things to ensure that only the
> parts of the buffer that are different from the corresponding file are
> replaced.  That keeps markers in the unchanged parts intact.
>
> However, with compressed files the file contents and the buffer contents
> are completely different, thus everything's replaced.
>
> Bye,
> Tassilo



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

* Re: emacs 24 problem: `revert` command forgets bindings from `occur` buffer for compressed files.
  2012-07-24  8:30       ` Paul K
@ 2012-07-24  8:42         ` Tassilo Horn
  0 siblings, 0 replies; 6+ messages in thread
From: Tassilo Horn @ 2012-07-24  8:42 UTC (permalink / raw)
  To: Paul K; +Cc: help-gnu-emacs

Paul K <mafeuser@gmail.com> writes:

> but it also forgets the (point), thus it looks like at least overlook
> if not a bug.

It could theoretically remember and restore the location of point, but
if you deleted some regions before the current point location without
saving and then revert, the position would be wrong anyway.  So I'm not
sure if it would be much on an improvement.

Bye,
Tassilo



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

end of thread, other threads:[~2012-07-24  8:42 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-07-10  7:35 emacs 24 problem: `revert` command forgets bindings from `occur` buffer for compressed files Paul K
2012-07-10  8:07 ` Tassilo Horn
2012-07-20 10:23   ` Paul K
2012-07-20 21:49     ` Tassilo Horn
2012-07-24  8:30       ` Paul K
2012-07-24  8:42         ` Tassilo Horn

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.