unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* package-install-from-buffer moves point
@ 2015-07-18 13:54 Peter Eisentraut
  2015-07-18 15:13 ` Artur Malabarba
  0 siblings, 1 reply; 6+ messages in thread
From: Peter Eisentraut @ 2015-07-18 13:54 UTC (permalink / raw)
  To: emacs-devel

package-install-from-buffer moves the point to somewhere in the package
header, because it moves around there as it parses the header entries.
This is pretty annoying when developing and testing a package.

This could be fixed by wrapping the body of package-buffer-info into
save-excursion.  This worked well for me, but it somehow broke several
tests in package-test.el in ways that I don't understand.  E.g.,

Test package-test-describe-package condition:
    (wrong-type-argument number-or-marker-p "Trace/BPT trap: 5")
   FAILED   4/19  package-test-describe-package

Any ideas?



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

* Re: package-install-from-buffer moves point
  2015-07-18 13:54 package-install-from-buffer moves point Peter Eisentraut
@ 2015-07-18 15:13 ` Artur Malabarba
  2015-07-19 16:12   ` Peter Eisentraut
  0 siblings, 1 reply; 6+ messages in thread
From: Artur Malabarba @ 2015-07-18 15:13 UTC (permalink / raw)
  To: Peter Eisentraut; +Cc: emacs-devel

This is due to calls to some `lm-*' functions inside
`package-buffer-info' (possibly one of the calls I added myself
yesterday). I can just wrap those in save-excursions, but I'm thinking
that the `lm-*' functions themselves should not be moving the point.
Shall I use save-excursion inside those functions instead?

2015-07-18 14:54 GMT+01:00 Peter Eisentraut <peter@eisentraut.org>:
> package-install-from-buffer moves the point to somewhere in the package
> header, because it moves around there as it parses the header entries.
> This is pretty annoying when developing and testing a package.
>
> This could be fixed by wrapping the body of package-buffer-info into
> save-excursion.  This worked well for me, but it somehow broke several
> tests in package-test.el in ways that I don't understand.  E.g.,
>
> Test package-test-describe-package condition:
>     (wrong-type-argument number-or-marker-p "Trace/BPT trap: 5")
>    FAILED   4/19  package-test-describe-package
>
> Any ideas?
>



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

* Re: package-install-from-buffer moves point
  2015-07-18 15:13 ` Artur Malabarba
@ 2015-07-19 16:12   ` Peter Eisentraut
  2015-07-19 17:06     ` Artur Malabarba
  0 siblings, 1 reply; 6+ messages in thread
From: Peter Eisentraut @ 2015-07-19 16:12 UTC (permalink / raw)
  To: bruce.connor.am; +Cc: emacs-devel

On 7/18/15 11:13 AM, Artur Malabarba wrote:
> This is due to calls to some `lm-*' functions inside
> `package-buffer-info' (possibly one of the calls I added myself
> yesterday). I can just wrap those in save-excursions, but I'm thinking
> that the `lm-*' functions themselves should not be moving the point.
> Shall I use save-excursion inside those functions instead?

Well, there is also a goto-char call right at the top of
package-buffer-info.  But I agree that the lm-* functions should
probably save the point themselves, too.  There are some calls to
save-excursion in lisp-mnt.el, but it seems it's not applied consistently.




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

* Re: package-install-from-buffer moves point
  2015-07-19 16:12   ` Peter Eisentraut
@ 2015-07-19 17:06     ` Artur Malabarba
  2015-11-07 18:03       ` Peter Eisentraut
  0 siblings, 1 reply; 6+ messages in thread
From: Artur Malabarba @ 2015-07-19 17:06 UTC (permalink / raw)
  To: Peter Eisentraut; +Cc: emacs-devel

>> This is due to calls to some `lm-*' functions inside
>> `package-buffer-info' (possibly one of the calls I added myself
>> yesterday). I can just wrap those in save-excursions, but I'm thinking
>> that the `lm-*' functions themselves should not be moving the point.
>> Shall I use save-excursion inside those functions instead?
>
> Well, there is also a goto-char call right at the top of
> package-buffer-info.

Clearly I should stop replying to messages on my phone where I can't
look at the code first. :)

> But I agree that the lm-* functions should
> probably save the point themselves, too.  There are some calls to
> save-excursion in lisp-mnt.el, but it seems it's not applied consistently.

Yes. `lm-header' always moves point to the header (besides returning
it). All the others I looked through seem to be fine.



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

* Re: package-install-from-buffer moves point
  2015-07-19 17:06     ` Artur Malabarba
@ 2015-11-07 18:03       ` Peter Eisentraut
  2015-11-07 22:51         ` Artur Malabarba
  0 siblings, 1 reply; 6+ messages in thread
From: Peter Eisentraut @ 2015-11-07 18:03 UTC (permalink / raw)
  To: bruce.connor.am; +Cc: emacs-devel

On 7/19/15 1:06 PM, Artur Malabarba wrote:
>>> This is due to calls to some `lm-*' functions inside
>>> `package-buffer-info' (possibly one of the calls I added myself
>>> yesterday). I can just wrap those in save-excursions, but I'm thinking
>>> that the `lm-*' functions themselves should not be moving the point.
>>> Shall I use save-excursion inside those functions instead?
>>
>> Well, there is also a goto-char call right at the top of
>> package-buffer-info.
> 
> Clearly I should stop replying to messages on my phone where I can't
> look at the code first. :)
> 
>> But I agree that the lm-* functions should
>> probably save the point themselves, too.  There are some calls to
>> save-excursion in lisp-mnt.el, but it seems it's not applied consistently.
> 
> Yes. `lm-header' always moves point to the header (besides returning
> it). All the others I looked through seem to be fine.

Did you (or someone) have a chance to work on this?





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

* Re: package-install-from-buffer moves point
  2015-11-07 18:03       ` Peter Eisentraut
@ 2015-11-07 22:51         ` Artur Malabarba
  0 siblings, 0 replies; 6+ messages in thread
From: Artur Malabarba @ 2015-11-07 22:51 UTC (permalink / raw)
  To: Peter Eisentraut; +Cc: emacs-devel

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

2015-11-07 18:03 GMT+00:00 Peter Eisentraut <peter@eisentraut.org>:
>
> On 7/19/15 1:06 PM, Artur Malabarba wrote:
> >>> This is due to calls to some `lm-*' functions inside
> >>> `package-buffer-info' (possibly one of the calls I added myself
> >>> yesterday). I can just wrap those in save-excursions, but I'm thinking
> >>> that the `lm-*' functions themselves should not be moving the point.
> >>> Shall I use save-excursion inside those functions instead?
> >>
> >> Well, there is also a goto-char call right at the top of
> >> package-buffer-info.
> >
> > Clearly I should stop replying to messages on my phone where I can't
> > look at the code first. :)
> >
> >> But I agree that the lm-* functions should
> >> probably save the point themselves, too. There are some calls to
> >> save-excursion in lisp-mnt.el, but it seems it's not applied
consistently.
> >
> > Yes. `lm-header' always moves point to the header (besides returning
> > it). All the others I looked through seem to be fine.
>
> Did you (or someone) have a chance to work on this?

Regrettably, no.
Feel free to do it if you'd like. It's really just a matter of fixing the
tests that fail when you save excursion.

[-- Attachment #2: Type: text/html, Size: 1585 bytes --]

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

end of thread, other threads:[~2015-11-07 22:51 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-07-18 13:54 package-install-from-buffer moves point Peter Eisentraut
2015-07-18 15:13 ` Artur Malabarba
2015-07-19 16:12   ` Peter Eisentraut
2015-07-19 17:06     ` Artur Malabarba
2015-11-07 18:03       ` Peter Eisentraut
2015-11-07 22:51         ` Artur Malabarba

Code repositories for project(s) associated with this public inbox

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

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).