Skip to content

Commit e82368a

Browse files
author
Chen Bin
committed
fixed ci
1 parent 7fc763a commit e82368a

File tree

2 files changed

+18
-23
lines changed

2 files changed

+18
-23
lines changed

‎README.org

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ Here is complete setup you could insert into =.emacs==,
228228
;; ignore files whose name match certain glob pattern
229229
(setq-local ffip-ignore-filenames '("*.bmp" "*.jpg"))
230230
;; exclude `dist/' directory
231-
(add-to-list 'ffip-prune-patterns "*/dist"))
231+
(push "*/dist" ffip-prune-patterns))
232232
;; insert more WHEN statements below this line for other projects
233233
)
234234
;; most major modes inherit from prog-mode, so below line is enough

‎find-file-in-project.el

Lines changed: 17 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
;;; find-file-in-project.el --- Find file/directory and review Diff/Patch/Commit efficiently -*- coding: utf-8 -*-
1+
;;; find-file-in-project.el --- Find file/directory and review Diff/Patch/Commit efficiently -*- lexical-binding: t -*-
22

33
;; Copyright (C) 2006-2009, 2011-2012, 2015-2018
44
;; Phil Hagelberg, Doug Alcorn, Will Farrington, Chen Bin
@@ -788,7 +788,6 @@ If KEYWORD is list, it's the list of file names.
788788
IF FIND-DIRECTORY-P is t, we are searching directories, else files."
789789
(let* ((default-directory (ffip-get-project-root-directory))
790790
(cmd (ffip-create-shell-command keyword find-directory-p))
791-
(fd-file-pattern (concat "^" (mapconcat 'ffip-glob-to-regex ffip-patterns "\\|") "$"))
792791
(collection (funcall ffip-project-search-function cmd))
793792
rlt)
794793

@@ -852,7 +851,7 @@ After opening the file, forward LNUM lines."
852851
If OPEN-ANOTHER-WINDOW is t, the results are displayed in a new window.
853852
If FIND-DIRECTORY-P is t, only search directories. FN is callback.
854853
This function is the API to find files."
855-
(let* (cands lnum file)
854+
(let (cands lnum)
856855
;; extract line num if exists
857856
(when (and keyword (stringp keyword)
858857
(string-match "^\\(.*\\):\\([0-9]+\\):?$" keyword))
@@ -921,8 +920,7 @@ Please note N is zero originated."
921920
rlt)
922921
(cond
923922
((region-active-p)
924-
(setq ffip-filename-history (add-to-list 'ffip-filename-history
925-
(ffip--read-selected)))
923+
(push (ffip--read-selected) ffip-filename-history)
926924
(setq rlt (ffip--read-selected)))
927925
(t
928926
(setq rlt (read-from-minibuffer hint nil nil nil 'ffip-filename-history))))
@@ -939,7 +937,7 @@ See (info \"(Emacs) Directory Variables\") for details."
939937
(concat (file-name-as-directory root) ".dir-locals.el"))))
940938
(when file
941939
(with-temp-buffer
942-
(let ((print-level nil) (print-length nil) sexp (rlt '(a)))
940+
(let ((print-level nil) (print-length nil) sexp)
943941
(cond
944942
;; modify existing .dir-locals.el
945943
((file-exists-p file)
@@ -956,13 +954,13 @@ See (info \"(Emacs) Directory Variables\") for details."
956954
(if (assoc 'ffip-project-root sub-sexp)
957955
(setq new-sub-sexp (delete (assoc 'ffip-project-root sub-sexp) sub-sexp))
958956
(setq new-sub-sexp sub-sexp))
959-
(add-to-list 'new-sub-sexp (ffip--prepare-root-data-for-project-file root) t)
957+
(push (ffip--prepare-root-data-for-project-file root) new-sub-sexp)
960958
;; update sexp
961959
(setq sexp (delete sub-sexp sexp))
962-
(add-to-list 'sexp new-sub-sexp))
960+
(push new-sub-sexp sexp))
963961
(t
964962
;; add `(nil (ffip-project-root . "path/file"))'
965-
(add-to-list 'sexp (list nil (ffip--prepare-root-data-for-project-file root))))))
963+
(push (list nil (ffip--prepare-root-data-for-project-file root)) sexp))))
966964
))
967965
(t
968966
;; a new .dir-locals.el
@@ -1108,8 +1106,7 @@ If OPEN-ANOTHER-WINDOW is not nil, the file will be opened in new window."
11081106
"Insert contents of file in current buffer.
11091107
The file name is selected interactively from candidates in project."
11101108
(interactive)
1111-
(let* ((cands (ffip-project-search (ffip-read-keyword)))
1112-
root)
1109+
(let* ((cands (ffip-project-search (ffip-read-keyword))))
11131110
(when (> (length cands) 0)
11141111
(ffip-completing-read (ffip-hint)
11151112
cands
@@ -1394,38 +1391,36 @@ If NUM is not nil, the corresponding backend is executed directly."
13941391
(i 0))
13951392
;; format backend descriptions
13961393
(dolist (b ffip-diff-backends)
1397-
(add-to-list 'descriptions
1398-
(format "%s: %s"
1399-
i
1400-
(ffip-backend-description b)) t)
1394+
(push (format "%s: %s" i (ffip-backend-description b)) descriptions)
14011395
(setq i (+ 1 i)))
14021396
(ffip-completing-read
14031397
"Run diff backend: "
1404-
descriptions
1398+
(nreverse descriptions)
14051399
(lambda (file)
14061400
(if (string-match "^\\([0-9]+\\): " file)
14071401
(ffip-show-diff-internal (string-to-number (match-string 1 file))))))))))
14081402

14091403
;;;###autoload
14101404
(defalias 'ffip-show-diff 'ffip-show-diff-by-description)
14111405

1412-
(defadvice read-file-name (around ffip-read-file-name-hack activate)
1413-
"Advice `read-file-name'."
1406+
(defun ffip-read-file-name-hack (orig-func &rest args)
1407+
"Advice `read-file-name' with ORIG-FUNC and ARGS for `ffip-diff-apply-hunk'."
14141408
(cond
14151409
(ffip-read-file-name-hijacked-p
14161410
;; only hack read-file-name once
14171411
(setq ffip-read-file-name-hijacked-p nil)
1418-
(let* ((args (ad-get-args 0))
1419-
(file-name (file-name-nondirectory (nth 2 args)))
1412+
(let* ((file-name (file-name-nondirectory (nth 2 args)))
14201413
(default-directory (ffip-project-root))
14211414
(cands (ffip-project-search file-name))
14221415
(rlt (if cands (ffip-completing-read "Files: " cands))))
1416+
(message "file-name=%s" file-name)
14231417
(when rlt
14241418
(setq rlt (file-truename rlt))
14251419
(run-hook-with-args 'ffip-diff-apply-hunk-hook rlt)
1426-
(setq ad-return-value rlt))))
1420+
rlt)))
14271421
(t
1428-
ad-do-it)))
1422+
(apply orig-func args))))
1423+
(advice-add 'read-file-name :around #'ffip-read-file-name-hack)
14291424

14301425
;;;###autoload
14311426
(defun ffip-diff-apply-hunk (&optional reverse)

0 commit comments

Comments
 (0)