unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Re: [Emacs-diffs] trunk r115918: package.el: various fixes.
       [not found] <E1W0rBI-0004nD-NV@vcs.savannah.gnu.org>
@ 2014-01-08 14:16 ` Stefan Monnier
  2014-01-08 15:00   ` Bastien
  2014-01-08 17:05   ` Glenn Morris
  0 siblings, 2 replies; 4+ messages in thread
From: Stefan Monnier @ 2014-01-08 14:16 UTC (permalink / raw)
  To: Bastien Guerry; +Cc: emacs-devel

> @@ -881,13 +881,14 @@
>    "Return true if PACKAGE, of MIN-VERSION or newer, is installed.
>  MIN-VERSION should be a version list."
>    (unless package--initialized (error "package.el is not yet initialized!"))
> +  (when (assq package package-alist)
>      (or
>       (let ((pkg-descs (cdr (assq package package-alist))))
>         (and pkg-descs
>              (version-list-<= min-version
>                               (package-desc-version (car pkg-descs)))))
>       ;; Also check built-in packages.
> -     (package-built-in-p package min-version)))
> +     (package-built-in-p package min-version))))
 
Could you explain in which circumstance you found this necessary?
This might point to a problem elsewhere,


        Stefan



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

* Re: [Emacs-diffs] trunk r115918: package.el: various fixes.
  2014-01-08 14:16 ` [Emacs-diffs] trunk r115918: package.el: various fixes Stefan Monnier
@ 2014-01-08 15:00   ` Bastien
  2014-01-08 17:05   ` Glenn Morris
  1 sibling, 0 replies; 4+ messages in thread
From: Bastien @ 2014-01-08 15:00 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: emacs-devel

Stefan Monnier <monnier@iro.umontreal.ca> writes:

>> @@ -881,13 +881,14 @@
>>    "Return true if PACKAGE, of MIN-VERSION or newer, is installed.
>>  MIN-VERSION should be a version list."
>>    (unless package--initialized (error "package.el is not yet initialized!"))
>> +  (when (assq package package-alist)
>>      (or
>>       (let ((pkg-descs (cdr (assq package package-alist))))
>>         (and pkg-descs
>>              (version-list-<= min-version
>>                               (package-desc-version (car pkg-descs)))))
>>       ;; Also check built-in packages.
>> -     (package-built-in-p package min-version)))
>> +     (package-built-in-p package min-version))))
>  
> Could you explain in which circumstance you found this necessary?

This is not necessary (as in "this does not fix a bug") but
since package-installed-p is more like to return nil than t*,
then it's quickier to first check (assq package package-alist)
instead of checking by the package descriptions.

* Assuming most people don't install the majority of packages,
  of course.

> This might point to a problem elsewhere,

In general, package.el goes directly at checking descriptions
instead of the names, but for checking the mere existence I
don't think it's necessary -- at least it's not anymore, now
that the structure of package-alist is that of what its docstring
describes.

-- 
 Bastien



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

* Re: [Emacs-diffs] trunk r115918: package.el: various fixes.
  2014-01-08 14:16 ` [Emacs-diffs] trunk r115918: package.el: various fixes Stefan Monnier
  2014-01-08 15:00   ` Bastien
@ 2014-01-08 17:05   ` Glenn Morris
  2014-01-08 17:40     ` Bastien
  1 sibling, 1 reply; 4+ messages in thread
From: Glenn Morris @ 2014-01-08 17:05 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Bastien Guerry, emacs-devel


>> +  (when (assq package package-alist)
>>      (or
>>       (let ((pkg-descs (cdr (assq package package-alist))))

This is redundant (accesses same thing twice).

>>         (and pkg-descs
>>              (version-list-<= min-version
>>                               (package-desc-version (car pkg-descs)))))
>>       ;; Also check built-in packages.
>> -     (package-built-in-p package min-version)))
>> +     (package-built-in-p package min-version))))

It also seems to make the "Also check built-in packages." branch unreachable.



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

* Re: [Emacs-diffs] trunk r115918: package.el: various fixes.
  2014-01-08 17:05   ` Glenn Morris
@ 2014-01-08 17:40     ` Bastien
  0 siblings, 0 replies; 4+ messages in thread
From: Bastien @ 2014-01-08 17:40 UTC (permalink / raw)
  To: Glenn Morris; +Cc: Stefan Monnier, emacs-devel

Glenn Morris <rgm@gnu.org> writes:

>>> +  (when (assq package package-alist)
>>>      (or
>>>       (let ((pkg-descs (cdr (assq package package-alist))))
>
> This is redundant (accesses same thing twice).
>
>>>         (and pkg-descs
>>>              (version-list-<= min-version
>>>                               (package-desc-version (car pkg-descs)))))
>>>       ;; Also check built-in packages.
>>> -     (package-built-in-p package min-version)))
>>> +     (package-built-in-p package min-version))))
>
> It also seems to make the "Also check built-in packages." branch
> unreachable.

Yes, fixed, thanks.

-- 
 Bastien



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

end of thread, other threads:[~2014-01-08 17:40 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <E1W0rBI-0004nD-NV@vcs.savannah.gnu.org>
2014-01-08 14:16 ` [Emacs-diffs] trunk r115918: package.el: various fixes Stefan Monnier
2014-01-08 15:00   ` Bastien
2014-01-08 17:05   ` Glenn Morris
2014-01-08 17:40     ` Bastien

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