Only remove when a match has been found

* dispass.el (dispass-remove-label): Only remove a label if it has
  been found and don't throw an error when it hasn't.
This commit is contained in:
Tom Willemsen 2012-07-08 17:44:29 +02:00
parent 9bd8cdaaa5
commit c7a86ac858

View file

@ -214,9 +214,9 @@ an eye out for LABEL."
(with-temp-buffer (with-temp-buffer
(insert-file-contents dispass-file) (insert-file-contents dispass-file)
(re-search-forward (concat "^" label)) (when (re-search-forward (concat "^" label) nil t)
(kill-whole-line) (kill-whole-line)
(write-file dispass-file)) (write-file dispass-file)))
(when labels-mode-p (when labels-mode-p
(revert-buffer)))) (revert-buffer))))