[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Quilt-dev] [PATCH] lib/emacs: read QUILT_PC from config file
From: |
Dmitry Monakhov |
Subject: |
[Quilt-dev] [PATCH] lib/emacs: read QUILT_PC from config file |
Date: |
Sun, 10 Feb 2019 16:21:04 +0300 |
Read QUILT_PC from config instead of using hardcoded one.
Do it as we do with QUILT_PATCHES var.
Index: quilt/lib/quilt.el
===================================================================
--- quilt.orig/lib/quilt.el 2019-02-10 14:47:15.075443410 +0300
+++ quilt/lib/quilt.el 2019-02-10 15:56:14.889649096 +0300
@@ -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 @@
(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))))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Quilt-dev] [PATCH] lib/emacs: read QUILT_PC from config file,
Dmitry Monakhov <=