From 2079e6c4b340cea55d8b9254bca54cf3ce486d7c Mon Sep 17 00:00:00 2001 From: Tom Willemsen Date: Sun, 20 Jan 2013 15:58:35 +0100 Subject: Add support for the -f switch The option `dispass-labelfile' specifies the labelfile you would like to use instead of the one provided by DisPass itself. These changes should be cleaned up later, but for now it works. --- dispass.el | 30 ++++++++++++++++++++++++++---- 1 file changed, 26 insertions(+), 4 deletions(-) diff --git a/dispass.el b/dispass.el index 28d44bd..cd30098 100644 --- a/dispass.el +++ b/dispass.el @@ -53,6 +53,14 @@ :type 'string :risky t) +(defcustom dispass-labelfile nil + "The location of your preferred labelfile, a value of `nil' + means to just let DisPass figure it out." + :package-version '(dispass . "1.1.1") + :group 'dispass + :type 'file + :risky t) + (defvar dispass-labels-mode-map (let ((map (make-sparse-keymap))) (set-keymap-parent map tabulated-list-mode-map) @@ -132,6 +140,9 @@ an eye out for LABEL." (when (and seqno (> seqno 0)) (setq args (append `("-n" ,(number-to-string seqno)) args))) + (when dispass-labelfile + (setq args (append `("-f" ,dispass-labelfile) args))) + (setq proc (apply 'start-process "dispass" "*dispass*" dispass-executable args)) (set-process-sentinel proc 'dispass-process-sentinel) @@ -175,7 +186,10 @@ an eye out for LABEL." (defun dispass-read-labels () "Load a list of all labels into a buffer." (insert (shell-command-to-string - (concat dispass-labels-executable " -l --script"))) + (concat dispass-labels-executable + (when dispass-labelfile + (concat " -f " dispass-labelfile)) + " -l --script"))) (goto-char (point-min))) ;;;###autoload @@ -221,8 +235,12 @@ an eye out for LABEL." dispass-algorithms nil nil nil nil "dispass1") (read-from-minibuffer "Sequnce no. (1): " nil nil t nil "1"))) (shell-command - (format "%s --add %s:%d:%s:%s" - dispass-labels-executable label length algo seqno))) + (format "%s %s --add %s:%d:%s:%s" + dispass-labels-executable + (if dispass-labelfile + (concat "-f " dispass-labelfile) + "") + label length algo seqno))) ;;;###autoload (defun dispass-remove-label (label) @@ -235,7 +253,11 @@ thrown." (completing-read "Label: " (dispass-get-labels))))) (shell-command - (format "%s --remove %s" dispass-labels-executable label))) + (format "%s %s --remove %s" dispass-labels-executable + (if dispass-labelfile + (concat "-f " dispass-labelfile) + "") + label))) (defun dispass-from-button (button) "Call dispass with information from BUTTON." -- cgit v1.2.3-54-g00ecf