aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonas Bernoulli <jonas@bernoul.li>2019-04-16 08:02:00 +0200
committerJonas Bernoulli <jonas@bernoul.li>2019-04-17 19:30:08 +0200
commit0ae5a4f2542cc7b876225289081c2106dde4f8fc (patch)
treef04b1d9e22798680090cb81b68c86365d1d7fbaf
parentd30389d074197b4c304129b4c17d810df57b4743 (diff)
Temporarily remove bookmark support
-rw-r--r--default.mk1
-rw-r--r--lisp/Makefile1
-rw-r--r--lisp/magit-bookmark.el362
-rw-r--r--lisp/magit-diff.el10
-rw-r--r--lisp/magit-log.el14
-rw-r--r--lisp/magit-refs.el6
-rw-r--r--lisp/magit-stash.el10
-rw-r--r--lisp/magit-status.el6
-rw-r--r--lisp/magit-submodule.el6
-rw-r--r--lisp/magit.el6
10 files changed, 11 insertions, 411 deletions
diff --git a/default.mk b/default.mk
index 63b2d2f..8523d0a 100644
--- a/default.mk
+++ b/default.mk
@@ -89,7 +89,6 @@ ELS += magit-gitignore.el
ELS += magit-extras.el
ELS += git-rebase.el
ELS += magit-imenu.el
-ELS += magit-bookmark.el
ELCS = $(ELS:.el=.elc)
ELMS = magit.el $(filter-out $(addsuffix .el,$(PACKAGES)),$(ELS))
ELGS = magit-autoloads.el magit-version.el
diff --git a/lisp/Makefile b/lisp/Makefile
index 8a3698d..5bd89e8 100644
--- a/lisp/Makefile
+++ b/lisp/Makefile
@@ -58,7 +58,6 @@ magit-gitignore.elc: magit.elc
magit-extras.elc: magit.elc magit-merge.elc
git-rebase.elc: magit.elc
magit-imenu.elc: magit.elc git-rebase.elc
-magit-bookmark.elc: magit.elc
magit-obsolete.elc: magit.elc
## Build #############################################################
diff --git a/lisp/magit-bookmark.el b/lisp/magit-bookmark.el
deleted file mode 100644
index 0d35fe8..0000000
--- a/lisp/magit-bookmark.el
+++ /dev/null
@@ -1,362 +0,0 @@
-;;; magit-bookmark.el --- bookmark support for Magit -*- lexical-binding: t -*-
-
-;; Copyright (C) 2010-2019 The Magit Project Contributors
-;;
-;; You should have received a copy of the AUTHORS.md file which
-;; lists all contributors. If not, see http://magit.vc/authors.
-
-;; Author: Yuri Khan <yuri.v.khan@gmail.com>
-;; Maintainer: Jonas Bernoulli <jonas@bernoul.li>
-
-;; Magit is free software; you can redistribute it and/or modify it
-;; under the terms of the GNU General Public License as published by
-;; the Free Software Foundation; either version 3, or (at your option)
-;; any later version.
-;;
-;; Magit is distributed in the hope that it will be useful, but WITHOUT
-;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-;; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
-;; License for more details.
-;;
-;; You should have received a copy of the GNU General Public License
-;; along with Magit. If not, see http://www.gnu.org/licenses.
-
-;;; Commentary:
-
-;; Support for bookmarks for most Magit buffers.
-
-;;; Code:
-
-(eval-when-compile
- (require 'subr-x))
-
-(require 'magit)
-(require 'bookmark)
-
-;;; Supporting primitives
-
-(defun magit-bookmark--jump (bookmark fn &rest args)
- "Handle a Magit BOOKMARK.
-
-This function will:
-
-1. Bind `default-directory' to the repository root directory
- stored in the `filename' bookmark property.
-2. Invoke the function FN with ARGS as arguments. This needs to
- restore the buffer.
-3. Restore the expanded/collapsed status of top level sections
- and the point position."
- (declare (indent defun))
- (let ((default-directory (bookmark-get-filename bookmark)))
- (if default-directory
- (apply fn args)
- (signal 'bookmark-error-no-filename (list 'stringp default-directory)))
- (when-let ((hidden-sections (bookmark-prop-get bookmark
- 'magit-hidden-sections)))
- (dolist (child (oref magit-root-section children))
- (if (member (cons (oref child type)
- (oref child value))
- hidden-sections)
- (magit-section-hide child)
- (magit-section-show child))))
- (--when-let (bookmark-get-position bookmark)
- (goto-char it))
- (--when-let (bookmark-get-front-context-string bookmark)
- (when (search-forward it (point-max) t)
- (goto-char (match-beginning 0))))
- (--when-let (bookmark-get-rear-context-string bookmark)
- (when (search-backward it (point-min) t)
- (goto-char (match-end 0))))
- nil))
-
-(defun magit-bookmark--make-record (mode handler &optional name make-props)
- "Create a Magit bookmark.
-
-MODE specifies the expected major mode of current buffer.
-
-HANDLER should be a function that will be used to restore this
-buffer.
-
-NAME, if non-nil, is used as the name of the bookmark.
-
-MAKE-PROPS should be either nil or a function that will be called
-with `magit-refresh-args' as the argument list, and may return an
-alist whose every element has the form (PROP . VALUE) and
-specifies additional properties to store in the bookmark."
- (declare (indent 1))
- (unless (eq major-mode mode)
- (user-error "Not in a %s buffer" mode))
- (let ((bookmark (bookmark-make-record-default 'no-file)))
- (bookmark-prop-set bookmark 'handler handler)
- (bookmark-prop-set bookmark 'filename (magit-toplevel))
- (bookmark-prop-set
- bookmark 'magit-hidden-sections
- (--keep (and (oref it hidden)
- (cons (oref it type)
- (if (derived-mode-p 'magit-stash-mode)
- (replace-regexp-in-string
- (regexp-quote (car magit-refresh-args))
- magit-buffer-revision-hash
- (oref it value))
- (oref it value))))
- (oref magit-root-section children)))
- (when name
- (bookmark-prop-set bookmark 'defaults (list name)))
- (when make-props
- (pcase-dolist (`(,prop . ,value) (apply make-props magit-refresh-args))
- (bookmark-prop-set bookmark prop value)))
- bookmark))
-
-;;; Status
-
-;;;###autoload
-(defun magit-bookmark--status-jump (bookmark)
- "Handle a Magit status BOOKMARK."
- (magit-bookmark--jump bookmark
- (lambda () (magit-status-internal default-directory))))
-
-;;;###autoload
-(defun magit-bookmark--status-make-record ()
- "Create a Magit status bookmark."
- (magit-bookmark--make-record 'magit-status-mode
- #'magit-bookmark--status-jump))
-
-;;; Refs
-
-;;;###autoload
-(defun magit-bookmark--refs-jump (bookmark)
- "Handle a Magit refs BOOKMARK."
- (magit-bookmark--jump bookmark #'magit-show-refs
- (bookmark-prop-get bookmark 'magit-refs)
- (bookmark-prop-get bookmark 'magit-args)))
-
-;;;###autoload
-(defun magit-bookmark--refs-make-record ()
- "Create a Magit refs bookmark."
- (magit-bookmark--make-record 'magit-refs-mode
- #'magit-bookmark--refs-jump nil
- (lambda (refs args)
- `((magit-refs . ,refs)
- (magit-args . ,args)))))
-
-;;; Log
-
-;;;###autoload
-(defun magit-bookmark--log-jump (bookmark)
- "Handle a Magit log BOOKMARK."
- (magit-bookmark--jump bookmark #'magit-log-other
- (bookmark-prop-get bookmark 'magit-revs)
- (bookmark-prop-get bookmark 'magit-args)
- (bookmark-prop-get bookmark 'magit-files)))
-
-(defun magit-bookmark--log-make-name (revs _args files)
- "Generate the default name for a log bookmark."
- (concat (buffer-name) " "
- (mapconcat #'identity revs " ")
- (and files
- (concat " touching " (mapconcat #'identity files " ")))))
-
-;;;###autoload
-(defun magit-bookmark--log-make-record ()
- "Create a Magit log bookmark."
- (magit-bookmark--make-record 'magit-log-mode
- #'magit-bookmark--log-jump
- #'magit-bookmark--log-make-name
- (lambda (revs args files)
- `((magit-revs . ,revs)
- (magit-args . ,args)
- (magit-files . ,files)))))
-
-;;; Reflog
-
-;;;###autoload
-(defun magit-bookmark--reflog-jump (bookmark)
- "Handle a Magit reflog BOOKMARK."
- (magit-bookmark--jump bookmark
- (lambda ()
- (magit-git-reflog (bookmark-prop-get bookmark 'magit-ref)
- (bookmark-prop-get bookmark 'magit-args)))))
-
-(defun magit-bookmark--reflog-make-name (ref _args)
- "Generate the default name for a reflog bookmark."
- (concat (buffer-name) " " ref))
-
-;;;###autoload
-(defun magit-bookmark--reflog-make-record ()
- "Create a Magit reflog bookmark."
- (magit-bookmark--make-record 'magit-reflog-mode
- #'magit-bookmark--reflog-jump
- #'magit-bookmark--reflog-make-name
- (lambda (ref args)
- `((magit-ref . ,ref)
- (magit-args . ,args)))))
-
-;;; Stashes
-
-;;;###autoload
-(defun magit-bookmark--stashes-jump (bookmark)
- "Handle a Magit stash list BOOKMARK."
- (magit-bookmark--jump bookmark #'magit-stash-list))
-
-;;;###autoload
-(defun magit-bookmark--stashes-make-record ()
- "Create a Magit stash list bookmark."
- (magit-bookmark--make-record 'magit-stashes-mode
- #'magit-bookmark--stashes-jump))
-
-;;; Cherry
-
-;;;###autoload
-(defun magit-bookmark--cherry-jump (bookmark)
- "Handle a Magit cherry BOOKMARK."
- (magit-bookmark--jump bookmark #'magit-cherry
- (bookmark-prop-get bookmark 'magit-head)
- (bookmark-prop-get bookmark 'magit-upstream)))
-
-(defun magit-bookmark--cherry-make-name (upstream head)
- "Generate the default name for a cherry bookmark."
- (concat (buffer-name) " " head " upstream " upstream))
-
-;;;###autoload
-(defun magit-bookmark--cherry-make-record ()
- "Create a Magit cherry bookmark."
- (magit-bookmark--make-record 'magit-cherry-mode
- #'magit-bookmark--cherry-jump
- #'magit-bookmark--cherry-make-name
- (lambda (upstream head)
- `((magit-head . ,head)
- (magit-upstream . ,upstream)))))
-
-;;; Diff
-
-;;;###autoload
-(defun magit-bookmark--diff-jump (bookmark)
- "Handle a Magit diff BOOKMARK."
- (magit-bookmark--jump bookmark #'magit-diff-setup
- (bookmark-prop-get bookmark 'magit-rev-or-range)
- (bookmark-prop-get bookmark 'magit-const)
- (bookmark-prop-get bookmark 'magit-args)
- (bookmark-prop-get bookmark 'magit-files)))
-
-(defun magit-bookmark--resolve (rev-or-range)
- "Return REV-OR-RANGE with ref names resolved to commit hashes."
- (pcase (magit-git-lines "rev-parse" rev-or-range)
- (`(,rev)
- (magit-rev-abbrev rev))
- ((and `(,rev1 ,rev2)
- (guard (/= ?^ (aref rev1 0)))
- (guard (= ?^ (aref rev2 0))))
- (concat (magit-rev-abbrev (substring rev2 1))
- ".."
- (magit-rev-abbrev rev1)))
- ((and `(,rev1 ,rev2 ,rev3)
- (guard (/= ?^ (aref rev1 0)))
- (guard (/= ?^ (aref rev2 0)))
- (guard (= ?^ (aref rev3 0))))
- (ignore rev3)
- (concat (magit-rev-abbrev rev1)
- "..."
- (magit-rev-abbrev rev2)))
- (_
- rev-or-range)))
-
-(defun magit-bookmark--diff-make-name (rev-or-range const _args files)
- "Generate a default name for a diff bookmark."
- (if (member "--no-index" const)
- (apply #'format "*magit-diff %s %s" files)
- (concat (buffer-name) " "
- (cond ((magit-bookmark--resolve rev-or-range))
- ((member "--cached" const) "staged")
- (t "unstaged"))
- (and files
- (concat " in " (mapconcat #'identity files ", "))))))
-
-;;;###autoload
-(defun magit-bookmark--diff-make-record ()
- "Create a Magit diff bookmark."
- (magit-bookmark--make-record 'magit-diff-mode
- #'magit-bookmark--diff-jump
- #'magit-bookmark--diff-make-name
- (lambda (rev-or-range const args files)
- `((magit-rev-or-range . ,(magit-bookmark--resolve rev-or-range))
- (magit-const . ,const)
- (magit-args . ,args)
- (magit-files . ,files)))))
-
-;;; Revision
-
-;;;###autoload
-(defun magit-bookmark--revision-jump (bookmark)
- "Handle a Magit revision BOOKMARK."
- (magit-bookmark--jump bookmark #'magit-show-commit
- (bookmark-prop-get bookmark 'magit-rev)
- (bookmark-prop-get bookmark 'magit-args)
- (bookmark-prop-get bookmark 'magit-files)))
-
-(defun magit-bookmark--revision-make-name (_rev _ _args files)
- "Generate a default name for a revision bookmark."
- (concat (buffer-name) " "
- (magit-rev-abbrev magit-buffer-revision)
- (if files
- (concat " " (mapconcat #'identity files " "))
- (when-let ((subject (magit-rev-format "%s" magit-buffer-revision)))
- (concat " " subject)))))
-
-;;;###autoload
-(defun magit-bookmark--revision-make-record ()
- "Create a Magit revision bookmark."
- ;; magit-refresh-args stores the revision in relative form.
- ;; For bookmarks, the exact hash is more appropriate.
- (magit-bookmark--make-record 'magit-revision-mode
- #'magit-bookmark--revision-jump
- #'magit-bookmark--revision-make-name
- (lambda (_rev _ args files)
- `((magit-rev . ,magit-buffer-revision-hash)
- (magit-args . ,args)
- (magit-files . ,files)))))
-
-;;; Stash
-
-;;;###autoload
-(defun magit-bookmark--stash-jump (bookmark)
- "Handle a Magit stash BOOKMARK."
- (magit-bookmark--jump bookmark #'magit-stash-show
- (bookmark-prop-get bookmark 'magit-stash)
- (bookmark-prop-get bookmark 'magit-args)
- (bookmark-prop-get bookmark 'magit-files)))
-
-(defun magit-bookmark--stash-make-name (stash _args files)
- "Generate the default name for a stash bookmark."
- (concat (buffer-name) " "
- magit-buffer-revision-hash " "
- (if files
- (mapconcat #'identity files " ")
- (magit-rev-format "%s" stash))))
-
-;;;###autoload
-(defun magit-bookmark--stash-make-record ()
- "Create a Magit stash bookmark."
- (magit-bookmark--make-record 'magit-stash-mode
- #'magit-bookmark--stash-jump
- #'magit-bookmark--stash-make-name
- (lambda (_stash _ args files)
- `((magit-stash . ,magit-buffer-revision-hash)
- (magit-args . ,args)
- (magit-files . ,files)))))
-
-;;; Submodules
-
-;;;###autoload
-(defun magit-bookmark--submodules-jump (bookmark)
- "Handle a Magit submodule list BOOKMARK."
- (magit-bookmark--jump bookmark #'magit-list-submodules))
-
-;;;###autoload
-(defun magit-bookmark--submodules-make-record ()
- "Create a Magit submodule list bookmark."
- (magit-bookmark--make-record 'magit-submodule-list-mode
- #'magit-bookmark--submodules-jump))
-
-;;; _
-(provide 'magit-bookmark)
-;;; magit-bookmark.el ends here
diff --git a/lisp/magit-diff.el b/lisp/magit-diff.el
index 970613d..be32f5a 100644
--- a/lisp/magit-diff.el
+++ b/lisp/magit-diff.el
@@ -68,8 +68,6 @@
(require 'diff-mode)
(require 'smerge-mode)
-(defvar bookmark-make-record-function)
-
;;; Options
;;;; Diff Mode
@@ -1718,9 +1716,7 @@ Staging and applying changes is documented in info node
(setq imenu-prev-index-position-function
'magit-imenu--diff-prev-index-position-function)
(setq imenu-extract-index-name-function
- 'magit-imenu--diff-extract-index-name-function)
- (setq-local bookmark-make-record-function
- 'magit-bookmark--diff-make-record))
+ 'magit-imenu--diff-extract-index-name-function))
(defun magit-diff-refresh-buffer (rev-or-range const _args files)
"Refresh the current `magit-diff-mode' buffer.
@@ -2112,9 +2108,7 @@ Staging and applying changes is documented in info node
\\{magit-revision-mode-map}"
:group 'magit-revision
- (hack-dir-local-variables-non-file-buffer)
- (setq-local bookmark-make-record-function
- 'magit-bookmark--revision-make-record))
+ (hack-dir-local-variables-non-file-buffer))
(defun magit-revision-refresh-buffer (rev __const _args files)
(magit-set-header-line-format
diff --git a/lisp/magit-log.el b/lisp/magit-log.el
index 134e31a..c8e6ef6 100644
--- a/lisp/magit-log.el
+++ b/lisp/magit-log.el
@@ -55,8 +55,6 @@
(eval-when-compile
(require 'subr-x))
-(defvar bookmark-make-record-function)
-
;;; Options
;;;; Log Mode
@@ -938,9 +936,7 @@ Type \\[magit-reset] to reset `HEAD' to the commit at point.
(setq imenu-prev-index-position-function
'magit-imenu--log-prev-index-position-function)
(setq imenu-extract-index-name-function
- 'magit-imenu--log-extract-index-name-function)
- (setq-local bookmark-make-record-function
- 'magit-bookmark--log-make-record))
+ 'magit-imenu--log-extract-index-name-function))
(defvar magit-log-disable-graph-hack-args
'("-G" "--grep" "--author")
@@ -1552,9 +1548,7 @@ Type \\[magit-cherry-pick] to apply the commit at point.
:group 'magit-log
(hack-dir-local-variables-non-file-buffer)
(setq imenu-create-index-function
- 'magit-imenu--cherry-create-index-function)
- (setq-local bookmark-make-record-function
- 'magit-bookmark--cherry-make-record))
+ 'magit-imenu--cherry-create-index-function))
;;;###autoload
(defun magit-cherry (head upstream)
@@ -1614,9 +1608,7 @@ Type \\[magit-reset] to reset `HEAD' to the commit at point.
\\{magit-reflog-mode-map}"
:group 'magit-log
- (hack-dir-local-variables-non-file-buffer)
- (setq-local bookmark-make-record-function
- 'magit-bookmark--reflog-make-record))
+ (hack-dir-local-variables-non-file-buffer))
(defun magit-reflog-refresh-buffer (ref args)
(magit-set-header-line-format (concat "Reflog for " ref))
diff --git a/lisp/magit-refs.el b/lisp/magit-refs.el
index 516c759..d0ec112 100644
--- a/lisp/magit-refs.el
+++ b/lisp/magit-refs.el
@@ -32,8 +32,6 @@
(require 'magit)
-(defvar bookmark-make-record-function)
-
;;; Options
(defgroup magit-refs nil
@@ -298,9 +296,7 @@ Type \\[magit-reset] to reset `HEAD' to the commit at point.
:group 'magit-refs
(hack-dir-local-variables-non-file-buffer)
(setq imenu-create-index-function
- #'magit-imenu--refs-create-index-function)
- (setq-local bookmark-make-record-function
- #'magit-bookmark--refs-make-record))
+ #'magit-imenu--refs-create-index-function))
(defun magit-refs-refresh-buffer (ref &optional args)
(setq magit-set-buffer-margin-refresh (not (magit-buffer-margin-p)))
diff --git a/lisp/magit-stash.el b/lisp/magit-stash.el
index 5178b74..c5b400a 100644
--- a/lisp/magit-stash.el
+++ b/lisp/magit-stash.el
@@ -32,8 +32,6 @@
(require 'magit)
-(defvar bookmark-make-record-function)
-
;;; Options
(defgroup magit-stash nil
@@ -413,9 +411,7 @@ instead of \"Stashes:\"."
(define-derived-mode magit-stashes-mode magit-reflog-mode "Magit Stashes"
"Mode for looking at lists of stashes."
:group 'magit-log
- (hack-dir-local-variables-non-file-buffer)
- (setq-local bookmark-make-record-function
- #'magit-bookmark--stashes-make-record))
+ (hack-dir-local-variables-non-file-buffer))
(cl-defun magit-stashes-refresh-buffer (ref)
(magit-insert-section (stashesbuf)
@@ -440,9 +436,7 @@ instead of \"Stashes:\"."
(define-derived-mode magit-stash-mode magit-diff-mode "Magit Stash"
"Mode for looking at individual stashes."
:group 'magit-diff
- (hack-dir-local-variables-non-file-buffer)
- (setq-local bookmark-make-record-function
- #'magit-bookmark--stash-make-record))
+ (hack-dir-local-variables-non-file-buffer))
(defun magit-stash-refresh-buffer (stash _const _args _files)
(magit-set-header-line-format
diff --git a/lisp/magit-status.el b/lisp/magit-status.el
index 4ae4ce8..807bd5f 100644
--- a/lisp/magit-status.el
+++ b/lisp/magit-status.el
@@ -32,8 +32,6 @@
(require 'magit)
-(defvar bookmark-make-record-function)
-
;;; Options
(defgroup magit-status nil
@@ -341,9 +339,7 @@ Type \\[magit-commit] to create a commit.
:group 'magit-status
(hack-dir-local-variables-non-file-buffer)
(setq imenu-create-index-function
- 'magit-imenu--status-create-index-function)
- (setq-local bookmark-make-record-function
- #'magit-bookmark--status-make-record))
+ 'magit-imenu--status-create-index-function))
(defun magit-status-refresh-buffer ()
(magit-git-exit-code "update-index" "--refresh")
diff --git a/lisp/magit-submodule.el b/lisp/magit-submodule.el
index bc473f9..6a9e2b8 100644
--- a/lisp/magit-submodule.el
+++ b/lisp/magit-submodule.el
@@ -29,8 +29,6 @@
(require 'magit)
(defvar x-stretch-cursor)
-(defvar bookmark-make-record-function)
-
;;; Options
(defcustom magit-module-sections-hook
@@ -608,9 +606,7 @@ These sections can be expanded to show the respective commits."
(setq imenu-prev-index-position-function
#'magit-imenu--submodule-prev-index-position-function)
(setq imenu-extract-index-name-function
- #'magit-imenu--submodule-extract-index-name-function)
- (setq-local bookmark-make-record-function
- #'magit-bookmark--submodules-make-record))
+ #'magit-imenu--submodule-extract-index-name-function))
(defun magit-submodule-list-refresh ()
(setq tabulated-list-entries
diff --git a/lisp/magit.el b/lisp/magit.el
index d5ee11f..382d3c2 100644
--- a/lisp/magit.el
+++ b/lisp/magit.el
@@ -580,11 +580,7 @@ For X11 something like ~/.xinitrc should work.\n"
(require 'magit-gitignore)
(require 'magit-extras)
(require 'git-rebase)
- (require 'magit-imenu)
- (require 'magit-bookmark)))
-
-(eval-after-load 'bookmark
- '(require 'magit-bookmark))
+ (require 'magit-imenu)))
(if after-init-time
(progn (magit-startup-asserts)