Function: hypb-release-update-version

hypb-release-update-version is an autoloaded, interactive and byte-compiled function defined in hypb-release.el.

Signature

(hypb-release-update-version NEW-VERSION)

Documentation

Replace old-version with NEW-VERSION in hypb-release-version-files.

Old-version is fetched from hyperbole.el. Signal an error if a file does not exist or old-version is not found in every file.

All files are checked before any changes are made.

Files are saved normally by Emacs, so hooks are applied as if edited manually.

Key Bindings

Source Code

;; Defined in ~/.emacs.d/elpa/hyperbole-20261030.2317/hypb-release.el
;;;###autoload
(defun hypb-release-update-version (new-version)
  "Replace old-version with NEW-VERSION in `hypb-release-version-files'.

Old-version is fetched from hyperbole.el.  Signal an error if a file
does not exist or old-version is not found in every file.

All files are checked before any changes are made.

Files are saved normally by Emacs, so hooks are applied as if edited manually."
  (interactive
   (list (read-string "New version: ")))

  (let ((old-version (lm-version "hyperbole.el")))
    ;; Check all files before any action.
    (dolist (v hypb-release-version-file-list)
      (let ((file (nth 0 v))
            (pattern (nth 1 v))
            (optional (nth 2 v)))
        (unless (or optional (file-exists-p file))
          (error "File does not exist: %s" file))
        (when (file-exists-p file)
          (with-temp-buffer
            (insert-file-contents file)
            (unless (hypb-release--replace-version pattern old-version new-version 'dry-run)
              (error "Version %s not found in %s"
                     old-version file))))))

    ;; Substitute and save all.
    (let ((replacements 0)
          (files))
      (dolist (v hypb-release-version-file-list)
        (let ((file (nth 0 v))
              (pattern (nth 1 v)))
          (when (file-exists-p file)
            (with-current-buffer (find-file-noselect file)
              (unless (hypb-release--replace-version pattern old-version new-version)
                (error "Version %s not found in %s" old-version file))
              (setq replacements (1+ replacements))
              (cl-pushnew file files :test 'equal)
              (save-buffer)))))

      (message "Version %s -> %s: %d replacements in %d files"
               old-version new-version
               replacements (length files)))))