Browse Source

Use -safe-path

master
10sr 6 years ago
parent
commit
d86f0df06c
Signed by: 10sr GPG Key ID: C384BB17CBB19347
1 changed files with 20 additions and 20 deletions
  1. +20
    -20
      emacs.el

+ 20
- 20
emacs.el View File

@@ -1689,8 +1689,8 @@ and search from projectile root (if projectile is available)."
(safe-require-or-eval 'projectile) (safe-require-or-eval 'projectile)
(projectile-project-p)) (projectile-project-p))
(projectile-with-default-dir (projectile-project-root) (projectile-with-default-dir (projectile-project-root)
(compilation-start command-args
'grep-mode))
(compilation-start command-args
'grep-mode))
(compilation-start command-args (compilation-start command-args
'grep-mode))) 'grep-mode)))


@@ -1708,8 +1708,8 @@ and search from projectile root (if projectile is available)."
(if (safe-require-or-eval 'projectile) (if (safe-require-or-eval 'projectile)
(projectile-with-default-dir (or (projectile-project-root) (projectile-with-default-dir (or (projectile-project-root)
default-directory) default-directory)
(compilation-start command-args
'grep-mode))
(compilation-start command-args
'grep-mode))
(compilation-start command-args (compilation-start command-args
'grep-mode)))) 'grep-mode))))


@@ -2581,7 +2581,7 @@ If target path is not found in COMMITISH tree, go up path and try again until fo


(defun git-walktree--path-in-repository (path) (defun git-walktree--path-in-repository (path)
"Convert PATH into relative path to repository root. "Convert PATH into relative path to repository root.
Result will not have leading and trailing slashes."
Result will not have leading and trailing slashes."
(with-temp-buffer (with-temp-buffer
(cd (if (file-directory-p path) (cd (if (file-directory-p path)
path path
@@ -2598,7 +2598,7 @@ Result will not have leading and trailing slashes."


(defcustom git-walktree-try-cd t (defcustom git-walktree-try-cd t
"Try to cd if directory exists in current working directory if non-nil. "Try to cd if directory exists in current working directory if non-nil.
Otherwise use repository root for gitwalktree buffer's `default-directory'."
Otherwise use repository root for gitwalktree buffer's `default-directory'."
:type 'boolean :type 'boolean
:group 'git-walktree) :group 'git-walktree)


@@ -2612,7 +2612,7 @@ Otherwise use repository root for gitwalktree buffer's `default-directory'."


(defun git-walktree--git-plumbing (&rest args) (defun git-walktree--git-plumbing (&rest args)
"Run git plubming command with ARGS. "Run git plubming command with ARGS.
Returns first line of output without newline."
Returns first line of output without newline."
(with-temp-buffer (with-temp-buffer
(let ((status (apply 'call-process (let ((status (apply 'call-process
git-walktree-git-executable git-walktree-git-executable
@@ -2643,11 +2643,11 @@ Returns first line of output without newline."
(defun git-walktree--parse-lstree-line (str) (defun git-walktree--parse-lstree-line (str)
"Extract object info from STR. "Extract object info from STR.


STR should be a string like following without newline.:
STR should be a string like following without newline.:


100644 blob 6fd4d58202d0b46547c6fe43de0f8c878456f966 .editorconfig
100644 blob 6fd4d58202d0b46547c6fe43de0f8c878456f966 .editorconfig


Returns property list like (:mode MODE :type TYPE :object OBJECT :file FILE)."
Returns property list like (:mode MODE :type TYPE :object OBJECT :file FILE)."
(let (result mode type object file) (let (result mode type object file)
(save-match-data (save-match-data
(with-temp-buffer (with-temp-buffer
@@ -2689,7 +2689,7 @@ Returns property list like (:mode MODE :type TYPE :object OBJECT :file FILE)."


(defun git-walktree--join-path (name &optional base) (defun git-walktree--join-path (name &optional base)
"Make path from NAME and BASE. "Make path from NAME and BASE.
If base is omitted or nil use value of `git-walktree-current-path'."
If base is omitted or nil use value of `git-walktree-current-path'."
(setq base (or base (setq base (or base
git-walktree-current-path)) git-walktree-current-path))
(cl-assert base) (cl-assert base)
@@ -2699,8 +2699,8 @@ If base is omitted or nil use value of `git-walktree-current-path'."


(defun git-walktree--parent-directory (path) (defun git-walktree--parent-directory (path)
"Return parent directory of PATH without trailing slash. "Return parent directory of PATH without trailing slash.
For root directory return \".\".
If PATH is equal to \".\", return nil."
For root directory return \".\".
If PATH is equal to \".\", return nil."
(if (string-match-p "/" path) (if (string-match-p "/" path)
(directory-file-name (file-name-directory path)) (directory-file-name (file-name-directory path))
(if (string= "." path) (if (string= "." path)
@@ -2709,7 +2709,7 @@ If PATH is equal to \".\", return nil."


(defun git-walktree-up (&optional committish path) (defun git-walktree-up (&optional committish path)
"Open parent directory of COMMITTISH and PATH. "Open parent directory of COMMITTISH and PATH.
If not given, value of current buffer will be used."
If not given, value of current buffer will be used."
(interactive) (interactive)
(setq committish (setq committish
(or committish git-walktree-current-committish)) (or committish git-walktree-current-committish))
@@ -2725,7 +2725,7 @@ If not given, value of current buffer will be used."
(defun git-walktree-mode--move-to-file () (defun git-walktree-mode--move-to-file ()
"Move point to file field of ls-tree output in current line. "Move point to file field of ls-tree output in current line.


This function do nothing when current line is not ls-tree output."
This function do nothing when current line is not ls-tree output."
(interactive) (interactive)
(save-match-data (save-match-data
(when (save-excursion (when (save-excursion
@@ -2768,11 +2768,11 @@ This function do nothing when current line is not ls-tree output."


(defvar git-walktree-known-child-revisions (make-hash-table :test 'equal) (defvar git-walktree-known-child-revisions (make-hash-table :test 'equal)
"Hash of already known pair of commitid -> list of child commitid. "Hash of already known pair of commitid -> list of child commitid.
Both values should be object full sha1 names.")
Both values should be object full sha1 names.")


(defun git-walktree--put-child (parent child) (defun git-walktree--put-child (parent child)
"Register PARENT and CHILD relationship. "Register PARENT and CHILD relationship.
PARENT should be a full sha1 object name."
PARENT should be a full sha1 object name."
;; Any way to check if PARENT is a full SHA-1 object name? ;; Any way to check if PARENT is a full SHA-1 object name?
(let ((current (gethash parent git-walktree-known-child-revisions))) (let ((current (gethash parent git-walktree-known-child-revisions)))
(unless (member child current) (unless (member child current)
@@ -2786,12 +2786,12 @@ PARENT should be a full sha1 object name."
;; git log --reverse --pretty=format:%H -n 1 --ancestry-path <PARENT>..HEAD ;; git log --reverse --pretty=format:%H -n 1 --ancestry-path <PARENT>..HEAD
(defun git-walktree--get-children (parent) (defun git-walktree--get-children (parent)
"Get known children list of PARENT commit. "Get known children list of PARENT commit.
PARENT should be a full sha1 object name."
PARENT should be a full sha1 object name."
(gethash parent git-walktree-known-child-revisions)) (gethash parent git-walktree-known-child-revisions))


(defun git-walktree--choose-committish (prompt-format collection) (defun git-walktree--choose-committish (prompt-format collection)
"Emit PROMPT-FORMAT and ask user to which committish of COLLECTION to use. "Emit PROMPT-FORMAT and ask user to which committish of COLLECTION to use.
When collection has just one element, return the first element without asking."
When collection has just one element, return the first element without asking."
(cl-assert collection) (cl-assert collection)
(if (< (length collection) 2) (if (< (length collection) 2)
(car collection) (car collection)
@@ -2805,7 +2805,7 @@ When collection has just one element, return the first element without asking."


(defun git-walktree-parent-revision () (defun git-walktree-parent-revision ()
"Open parent revision of current path. "Open parent revision of current path.
If current path was not found in the parent revision try to go up path."
If current path was not found in the parent revision try to go up path."
(interactive) (interactive)
(cl-assert git-walktree-current-committish) (cl-assert git-walktree-current-committish)
(let* ((commit-full-sha1 (git-walktree--git-plumbing "rev-parse" (let* ((commit-full-sha1 (git-walktree--git-plumbing "rev-parse"


Loading…
Cancel
Save