unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Dmitry Gutov <dmitry@gutov.dev>
To: Stefan Monnier <monnier@iro.umontreal.ca>, Eli Zaretskii <eliz@gnu.org>
Cc: adam@alphapapa.net, philipk@posteo.net, larsi@gnus.org,
	62750@debbugs.gnu.org
Subject: bug#62750: 29.0.50; Commands 'package-update' and 'package-update-all' should be called '*-upgrade'
Date: Mon, 24 Apr 2023 02:06:45 +0300	[thread overview]
Message-ID: <eedb8cf7-085a-b207-b08d-29d18726bee5@gutov.dev> (raw)
In-Reply-To: <54892fb9-fcc5-d036-e0de-e199712ff7d4@gutov.dev>

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

On 15/04/2023 04:34, Dmitry Gutov wrote:
> On 12/04/2023 16:34, Stefan Monnier wrote:
>>>> I hadn't realized that `package-update` hasn't been in a release 
>>>> yet, so
>>>> we don't need such a compatibility alias.
>>> Even though these commands were available under those names for the
>>> last year or so?
>> Well, that's for you to judge 😄
> 
> Since they're not very likely to be used in Lisp code, I'd say it's 
> unlikely to be a problem.
> 
> Alternatively, we'll probably get around to fixing this inconsistency 
> sometime after this release, and then carry the compatibility aliases 
> for a number of years.

Here's a couple of other existing functions:

   package--update-selected-packages
   package--update-downloads-in-progress

Neither of these relate to upgrading packages. Although the former could 
be easy to mistake for that now.

In all older functions, the term "update" (in comments and variable 
names) refers to updating the value of some variable, not packages.

By analogy, 'M-x package-update-all' might be easy enough to mistake for 
updating the list of packages available for installation, for example.

Here's a patch that does the rename. Also including package-vc-update* 
that Philip mentioned.

[-- Attachment #2: 0001-Rename-all-functions-called-package-update-to-packag.patch --]
[-- Type: text/x-patch, Size: 8537 bytes --]

From 13ff1f26da07f7302e898638ef4a5341c2913948 Mon Sep 17 00:00:00 2001
From: Dmitry Gutov <dmitry@gutov.dev>
Date: Mon, 24 Apr 2023 02:00:54 +0300
Subject: [PATCH] Rename all functions called package-*-update-* to
 package-*-upgrade-*

* lisp/emacs-lisp/package-vc.el (package-vc-upgrade-all):
Rename from 'package-vc-update-all'.
(package-vc-upgrade): Rename from 'package-vc-update'.

* lisp/emacs-lisp/package.el (package-upgrade):
Rename from 'package-update' (bug#62750).
(package--upgradeable-packages):
Rename from 'package--updateable-packages'.
(package-upgrade-all): Rename from 'package-update-all'.
---
 doc/emacs/package.texi        | 14 +++++++-------
 etc/NEWS                      |  6 +++---
 lisp/emacs-lisp/package-vc.el | 18 +++++++++---------
 lisp/emacs-lisp/package.el    | 34 +++++++++++++++++-----------------
 4 files changed, 36 insertions(+), 36 deletions(-)

diff --git a/doc/emacs/package.texi b/doc/emacs/package.texi
index 2b03399b0a7..d1766026db2 100644
--- a/doc/emacs/package.texi
+++ b/doc/emacs/package.texi
@@ -329,15 +329,15 @@ Package Installation
 @section Package Installation
 
 @findex package-install
-@findex package-update
-@findex package-update-all
+@findex package-upgrade
+@findex package-upgrade-all
   Packages are most conveniently installed using the package menu
 (@pxref{Package Menu}), but you can also use the command @kbd{M-x
 package-install}.  This prompts for the name of a package with the
 @samp{available} status, then downloads and installs it.  Similarly,
-if you want to update a package, you can use the @kbd{M-x
-package-update} command, and if you just want to update all the
-packages, you can use the @kbd{M-x package-update-all} command.
+if you want to upgrade a package, you can use the @kbd{M-x
+package-upgrade} command, and if you want to upgrade all the packages,
+you can use the @kbd{M-x package-upgrade-all} command.
 
 @cindex package requirements
   A package may @dfn{require} certain other packages to be installed,
@@ -551,8 +551,8 @@ Fetching Package Sources
 source code for a package directly from source.  The command will also
 automatically ensure that all files are byte-compiled and auto-loaded,
 just like with a regular package.  Packages installed this way behave
-just like any other package.  You can update them using
-@code{package-update} or @code{package-update-all} and delete them
+just like any other package.  You can upgrade them using
+@code{package-upgrade} or @code{package-upgrade-all} and delete them
 again using @code{package-delete}.  They are even displayed in the
 regular package listing.  If you just wish to clone the source of a
 package, without adding it to the package list, use
diff --git a/etc/NEWS b/etc/NEWS
index 1822ff17265..b6c9d9012b6 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -1828,13 +1828,13 @@ this includes "binary" buffers like 'archive-mode' and 'image-mode'.
 ** Package
 
 +++
-*** New command 'package-update'.
+*** New command 'package-upgrade'.
 This command allows you to upgrade packages without using 'M-x
 list-packages'.
 
 +++
-*** New command 'package-update-all'.
-This command allows updating all packages without any queries.
+*** New command 'package-upgrade-all'.
+This command allows upgrading all packages without any queries.
 
 +++
 *** New commands 'package-recompile' and 'package-recompile-all'.
diff --git a/lisp/emacs-lisp/package-vc.el b/lisp/emacs-lisp/package-vc.el
index af57095f8ce..fa9fce24acc 100644
--- a/lisp/emacs-lisp/package-vc.el
+++ b/lisp/emacs-lisp/package-vc.el
@@ -24,7 +24,7 @@
 
 ;; While packages managed by package.el use tarballs for distributing
 ;; the source code, this extension allows for packages to be fetched
-;; and updated directly from a version control system.
+;; and upgraded directly from a version control system.
 ;;
 ;; To install a package from source use `package-vc-install'.  If you
 ;; aren't interested in activating a package, you can use
@@ -660,19 +660,19 @@ package-vc--read-package-desc
                #'string=)))
 
 ;;;###autoload
-(defun package-vc-update-all ()
-  "Attempt to update all installed VC packages."
+(defun package-vc-upgrade-all ()
+  "Attempt to upgrade all installed VC packages."
   (interactive)
   (dolist (package package-alist)
     (dolist (pkg-desc (cdr package))
       (when (package-vc-p pkg-desc)
-        (package-vc-update pkg-desc))))
-  (message "Done updating packages."))
+        (package-vc-upgrade pkg-desc))))
+  (message "Done upgrading packages."))
 
 ;;;###autoload
-(defun package-vc-update (pkg-desc)
-  "Attempt to update the package PKG-DESC."
-  (interactive (list (package-vc--read-package-desc "Update VC package: " t)))
+(defun package-vc-upgrade (pkg-desc)
+  "Attempt to upgrade the package PKG-DESC."
+  (interactive (list (package-vc--read-package-desc "Upgrade VC package: " t)))
   ;; HACK: To run `package-vc--unpack-1' after checking out the new
   ;; revision, we insert a hook into `vc-post-command-functions', and
   ;; remove it right after it ran.  To avoid running the hook multiple
@@ -870,7 +870,7 @@ package-vc-rebuild
 cookies, re-compiling Emacs Lisp files, building and installing
 any documentation, downloading any missing dependencies.  This
 command does not fetch new revisions from a remote server.  That
-is the responsibility of `package-vc-update'.  Interactively,
+is the responsibility of `package-vc-upgrade'.  Interactively,
 prompt for the name of the package to rebuild."
   (interactive (list (package-vc--read-package-desc "Rebuild package: " t)))
   (package-vc--unpack-1 pkg-desc (package-desc-dir pkg-desc)))
diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el
index ffa6272dd1f..e15536c9f50 100644
--- a/lisp/emacs-lisp/package.el
+++ b/lisp/emacs-lisp/package.el
@@ -2263,24 +2263,24 @@ package-install
           (message  "Package `%s' installed." name))
       (message "`%s' is already installed" name))))
 
-(declare-function package-vc-update "package-vc" (pkg))
+(declare-function package-vc-upgrade "package-vc" (pkg))
 
 ;;;###autoload
-(defun package-update (name)
-  "Update package NAME if a newer version exists."
+(defun package-upgrade (name)
+  "Upgrade package NAME if a newer version exists."
   (interactive
    (list (completing-read
-          "Update package: " (package--updateable-packages) nil t)))
+          "Upgrade package: " (package--upgradeable-packages) nil t)))
   (let* ((package (if (symbolp name)
                       name
                     (intern name)))
          (pkg-desc (cadr (assq package package-alist))))
     (if (package-vc-p pkg-desc)
-        (package-vc-update pkg-desc)
+        (package-vc-upgrade pkg-desc)
       (package-delete pkg-desc 'force)
       (package-install package 'dont-select))))
 
-(defun package--updateable-packages ()
+(defun package--upgradeable-packages ()
   ;; Initialize the package system to get the list of package
   ;; symbols for completion.
   (package--archives-initialize)
@@ -2298,23 +2298,23 @@ package--updateable-packages
     package-alist)))
 
 ;;;###autoload
-(defun package-update-all (&optional query)
+(defun package-upgrade-all (&optional query)
   "Refresh package list and upgrade all packages.
-If QUERY, ask the user before updating packages.  When called
+If QUERY, ask the user before upgrading packages.  When called
 interactively, QUERY is always true."
   (interactive (list (not noninteractive)))
   (package-refresh-contents)
-  (let ((updateable (package--updateable-packages)))
-    (if (not updateable)
-        (message "No packages to update")
+  (let ((upgradeable (package--upgradeable-packages)))
+    (if (not upgradeable)
+        (message "No packages to upgrade")
       (when (and query
                  (not (yes-or-no-p
-                       (if (length= updateable 1)
-                           "One package to update.  Do it? "
-                         (format "%s packages to update.  Do it?"
-                                 (length updateable))))))
-        (user-error "Updating aborted"))
-      (mapc #'package-update updateable))))
+                       (if (length= upgradeable 1)
+                           "One package to upgrade.  Do it? "
+                         (format "%s packages to upgrade.  Do it?"
+                                 (length upgradeable))))))
+        (user-error "Upgrade aborted"))
+      (mapc #'package-upgrade upgradeable))))
 
 (defun package--dependencies (pkg)
   "Return a list of all dependencies PKG has.
-- 
2.37.2


  reply	other threads:[~2023-04-23 23:06 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-10 12:53 bug#62750: 29.0.50; Commands 'package-update' and 'package-update-all' should be called '*-upgrade' Adam Porter
2023-04-10 13:18 ` Eli Zaretskii
2023-04-10 13:25   ` Philip Kaludercic
2023-04-10 14:31     ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-04-11 21:28       ` Dmitry Gutov
2023-04-11 21:40         ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-04-12  7:35           ` Philip Kaludercic
2023-04-12 13:22             ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-04-12 13:28               ` Eli Zaretskii
2023-04-12 13:34                 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-04-15  1:34                   ` Dmitry Gutov
2023-04-23 23:06                     ` Dmitry Gutov [this message]
2023-04-24 12:02                       ` Eli Zaretskii
2023-04-24 17:28                         ` Adam Porter
2023-04-24 18:54                           ` Dmitry Gutov
2023-04-24 19:13                             ` Eli Zaretskii
2023-04-24 19:38                               ` Dmitry Gutov
2023-05-01  1:55                             ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-05-01 13:19                               ` Dmitry Gutov
2023-04-12 13:44               ` Philip Kaludercic
2023-04-12 14:36                 ` João Távora
2023-04-19 22:23         ` Jim Porter
2023-04-27 23:27 ` Dmitry Gutov
2023-04-28 14:26   ` Philip Kaludercic

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

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=eedb8cf7-085a-b207-b08d-29d18726bee5@gutov.dev \
    --to=dmitry@gutov.dev \
    --cc=62750@debbugs.gnu.org \
    --cc=adam@alphapapa.net \
    --cc=eliz@gnu.org \
    --cc=larsi@gnus.org \
    --cc=monnier@iro.umontreal.ca \
    --cc=philipk@posteo.net \
    /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 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).