[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/git-commit e9df33bf28 21/26: Silence warnings on older Ema
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/git-commit e9df33bf28 21/26: Silence warnings on older Emacs releases |
Date: |
Fri, 22 Apr 2022 18:58:15 -0400 (EDT) |
branch: elpa/git-commit
commit e9df33bf2862b4222c044bddaf60901279a153b3
Author: Jonas Bernoulli <jonas@bernoul.li>
Commit: Jonas Bernoulli <jonas@bernoul.li>
Silence warnings on older Emacs releases
---
lisp/magit-diff.el | 2 --
lisp/magit-extras.el | 62 ++++++++++++++++++++++++++-------------------------
lisp/magit-process.el | 6 ++---
3 files changed, 34 insertions(+), 36 deletions(-)
diff --git a/lisp/magit-diff.el b/lisp/magit-diff.el
index 00400403eb..82fa150061 100644
--- a/lisp/magit-diff.el
+++ b/lisp/magit-diff.el
@@ -41,8 +41,6 @@
;; For `magit-diff-popup'
(declare-function magit-stash-show "magit-stash" (stash &optional args files))
;; For `magit-diff-visit-file'
-(declare-function dired-jump "dired" ; dired-x before 27.1
- (&optional other-window file-name))
(declare-function magit-find-file-noselect "magit-files" (rev file))
(declare-function magit-status-setup-buffer "magit-status" (&optional
directory))
;; For `magit-diff-while-committing'
diff --git a/lisp/magit-extras.el b/lisp/magit-extras.el
index 92678b8846..4222b94cd0 100644
--- a/lisp/magit-extras.el
+++ b/lisp/magit-extras.el
@@ -31,12 +31,11 @@
(require 'magit)
-(declare-function change-log-insert-entries "add-log" (changelogs))
-(declare-function diff-add-log-current-defuns "diff-mode" ())
+;; For `magit-do-async-shell-command'.
(declare-function dired-read-shell-command "dired-aux" (prompt arg files))
;; For `magit-project-status'.
-(declare-function project-root "project" (project))
-(declare-function vc-git-command "vc-git" (buffer okstatus file-or-list &rest
flags))
+(declare-function vc-git-command "vc-git"
+ (buffer okstatus file-or-list &rest flags))
(defvar ido-exit)
(defvar ido-fallback)
@@ -226,7 +225,9 @@ like pretty much every other keymap:
(defun magit-project-status ()
"Run `magit-status' in the current project's root."
(interactive)
- (magit-status-setup-buffer (project-root (project-current t))))
+ (if (fboundp 'project-root)
+ (magit-status-setup-buffer (project-root (project-current t)))
+ (user-error "`magit-project-status' requires `project' 0.3.0 or greater")))
(defvar magit-bind-magit-project-status t
"Whether to bind \"m\" to `magit-project-status' in `project-prefix-map'.
@@ -390,31 +391,32 @@ in HEAD as well as staged changes in the diff to check."
(require 'diff-mode) ; `diff-add-log-current-defuns'.
(require 'vc-git) ; `vc-git-diff'.
(require 'add-log) ; `change-log-insert-entries'.
- (unless (and (fboundp 'change-log-insert-entries)
- (fboundp 'diff-add-log-current-defuns))
- (user-error "`magit-generate-changelog' requires Emacs 27 or greater"))
- (setq default-directory
- (if (and (file-regular-p "gitdir")
- (not (magit-git-true "rev-parse" "--is-inside-work-tree"))
- (magit-git-true "rev-parse" "--is-inside-git-dir"))
- (file-name-directory (magit-file-line "gitdir"))
- (magit-toplevel)))
- (let ((rev1 (if amending "HEAD^1" "HEAD"))
- (rev2 nil))
- ;; Magit may have updated the files without notifying vc, but
- ;; `diff-add-log-current-defuns' relies on vc being up-to-date.
- (mapc #'vc-file-clearprops (magit-staged-files))
- (change-log-insert-entries
- (with-temp-buffer
- (vc-git-command (current-buffer) 1 nil
- "diff-index" "--exit-code" "--patch"
- (and (magit-anything-staged-p) "--cached")
- rev1 "--")
- ;; `diff-find-source-location' consults these vars.
- (defvar diff-vc-revisions)
- (setq-local diff-vc-revisions (list rev1 rev2))
- (setq-local diff-vc-backend 'Git)
- (diff-add-log-current-defuns)))))
+ (cond
+ ((and (fboundp 'change-log-insert-entries)
+ (fboundp 'diff-add-log-current-defuns))
+ (setq default-directory
+ (if (and (file-regular-p "gitdir")
+ (not (magit-git-true "rev-parse" "--is-inside-work-tree"))
+ (magit-git-true "rev-parse" "--is-inside-git-dir"))
+ (file-name-directory (magit-file-line "gitdir"))
+ (magit-toplevel)))
+ (let ((rev1 (if amending "HEAD^1" "HEAD"))
+ (rev2 nil))
+ ;; Magit may have updated the files without notifying vc, but
+ ;; `diff-add-log-current-defuns' relies on vc being up-to-date.
+ (mapc #'vc-file-clearprops (magit-staged-files))
+ (change-log-insert-entries
+ (with-temp-buffer
+ (vc-git-command (current-buffer) 1 nil
+ "diff-index" "--exit-code" "--patch"
+ (and (magit-anything-staged-p) "--cached")
+ rev1 "--")
+ ;; `diff-find-source-location' consults these vars.
+ (defvar diff-vc-revisions)
+ (setq-local diff-vc-revisions (list rev1 rev2))
+ (setq-local diff-vc-backend 'Git)
+ (diff-add-log-current-defuns)))))
+ (t (user-error "`magit-generate-changelog' requires Emacs 27 or greater"))))
;;;###autoload
(defun magit-add-change-log-entry (&optional whoami file-name other-window)
diff --git a/lisp/magit-process.el b/lisp/magit-process.el
index ef9a8ce79f..619bd089a0 100644
--- a/lisp/magit-process.el
+++ b/lisp/magit-process.el
@@ -40,9 +40,6 @@
(require 'ansi-color)
(require 'with-editor)
-(declare-function auth-source-search "auth-source"
- (&rest spec &key max require create delete
&allow-other-keys))
-
;;; Options
(defcustom magit-process-connection-type (not (eq system-type 'cygwin))
@@ -838,7 +835,8 @@ be translated on the fly by doing this once
[1]:
https://docs.github.com/en/github/authenticating-to-github/creating-a-personal-access-token."
(require 'auth-source)
- (and (string-match "\\`\\(.+\\)@\\([^@]+\\)\\'" key)
+ (and (fboundp 'auth-source-search)
+ (string-match "\\`\\(.+\\)@\\([^@]+\\)\\'" key)
(let* ((user (match-string 1 key))
(host (match-string 2 key))
(secret
- [nongnu] elpa/git-commit bba16d4f3e 08/26: Use string-search instead of string-match, (continued)
- [nongnu] elpa/git-commit bba16d4f3e 08/26: Use string-search instead of string-match, ELPA Syncer, 2022/04/22
- [nongnu] elpa/git-commit a20dc0b83e 09/26: Use string-trim, ELPA Syncer, 2022/04/22
- [nongnu] elpa/git-commit 264e92436c 10/26: Use xor, ELPA Syncer, 2022/04/22
- [nongnu] elpa/git-commit b4b2098c91 15/26: Use with-environment-variables, ELPA Syncer, 2022/04/22
- [nongnu] elpa/git-commit b280fd7625 17/26: Use compat-assoc-delete-all, ELPA Syncer, 2022/04/22
- [nongnu] elpa/git-commit b0ababbde4 18/26: Use compat-alist-get, ELPA Syncer, 2022/04/22
- [nongnu] elpa/git-commit d69f062a8a 23/26: Refresh library headers, ELPA Syncer, 2022/04/22
- [nongnu] elpa/git-commit 77cc75ed90 16/26: Use image-property, ELPA Syncer, 2022/04/22
- [nongnu] elpa/git-commit 40fb3d2002 26/26: make: Improve creation of autoloads file, ELPA Syncer, 2022/04/22
- [nongnu] elpa/git-commit 8842230bca 14/26: Use length= and length>, ELPA Syncer, 2022/04/22
- [nongnu] elpa/git-commit e9df33bf28 21/26: Silence warnings on older Emacs releases,
ELPA Syncer <=
- [nongnu] elpa/git-commit a37b2066dd 22/26: Use pcase's quote upattern, ELPA Syncer, 2022/04/22
- [nongnu] elpa/git-commit 5a43c5f557 24/26: magit-tests.el: Use lexical-binding, ELPA Syncer, 2022/04/22
- [nongnu] elpa/git-commit 557b9d3df1 25/26: make: Right-align target verbs, ELPA Syncer, 2022/04/22