summaryrefslogtreecommitdiffstats
path: root/lib/quilt.el
diff options
context:
space:
mode:
authorDmitry Monakhov <dmtrmonakhov@yandex-team.ru>2019-03-14 16:42:37 +0100
committerJean Delvare <jdelvare@suse.de>2019-03-14 16:42:37 +0100
commitf7b69c58d21903baacb290840e7bed9282e357e2 (patch)
tree8f6156c9084e122597426aed7b72299a927f8f0f /lib/quilt.el
parenta03035f8f2bdc1466d5aa79b7b43dafaabc05295 (diff)
downloadquilt-f7b69c58d21903baacb290840e7bed9282e357e2.tar.gz
lib/emacs: read QUILT_PC from config file
Read QUILT_PC from config instead of using hardcoded one. Do it as we do with QUILT_PATCHES var.
Diffstat (limited to 'lib/quilt.el')
-rw-r--r--lib/quilt.el26
1 files changed, 21 insertions, 5 deletions
diff --git a/lib/quilt.el b/lib/quilt.el
index 47b65b9..ae73f3d 100644
--- a/lib/quilt.el
+++ b/lib/quilt.el
@@ -45,12 +45,28 @@
(or (getenv "QUILT_PATCHES")
"patches")))
+(defun quilt-pc-directory ()
+ "Return the location of patch files."
+ (or (with-current-buffer (generate-new-buffer " *cmd")
+ (shell-command
+ (concat "test -f ~/.quiltrc && . ~/.quiltrc ;"
+ "echo -n $QUILT_PC")
+ t)
+ (unwind-protect
+ (let ((v (buffer-string)))
+ (if (string= "" (buffer-string))
+ nil
+ v))
+ (kill-buffer (current-buffer))))
+ (or (getenv "QUILT_PC")
+ ".pc")))
+
(defun quilt-find-dir (fn &optional prefn)
"Return the top level dir of quilt from FN."
(if (or (not fn) (equal fn "/") (equal fn prefn))
nil
(let ((d (file-name-directory fn)))
- (if (file-accessible-directory-p (concat d "/.pc"))
+ (if (file-accessible-directory-p (concat d "/" (quilt-pc-directory)))
d
(quilt-find-dir (directory-file-name d) d)))))
@@ -84,7 +100,7 @@
(and
(not (string-match "\\(~$\\|\\.rej$\\)" fn))
(not (equal pd (quilt-patches-directory)))
- (not (equal pd ".pc"))
+ (not (equal pd (quilt-pc-directory)))
(quilt-p fn)))))
(defun quilt-cmd (cmd &optional buf)
@@ -176,9 +192,9 @@
(quilt-cmd "applied") ; to print error message
(setq dirs (if quilt-edit-top-only
(list (substring (quilt-cmd-to-string "top") 0 -1))
- (cdr (cdr (directory-files (concat qd ".pc/"))))))
+ (cdr (cdr (directory-files (concat qd (quilt-pc-directory) "/"))))))
(while (and (not result) dirs)
- (if (file-exists-p (concat qd ".pc/" (car dirs) "/" fn))
+ (if (file-exists-p (concat qd (quilt-pc-directory) "/" (car dirs) "/" fn))
(setq result t)
(setq dirs (cdr dirs))))
result))))
@@ -280,7 +296,7 @@ editability adjusted."
(message "no patch name is supplied")
(quilt-save)
(let (cmd first last)
- (if (file-exists-p (concat qd ".pc/" arg))
+ (if (file-exists-p (concat qd (quilt-pc-directory) "/" arg))
(progn
(setq cmd "pop")
(setq first (car (quilt-cmd-to-list (concat "next " arg))))