[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master 891be1d 199/399: counsel.el (counsel-org-file): Handle ATT
From: |
Oleh Krehel |
Subject: |
[elpa] master 891be1d 199/399: counsel.el (counsel-org-file): Handle ATTACH_DIR property |
Date: |
Sat, 20 Jul 2019 14:57:23 -0400 (EDT) |
branch: master
commit 891be1d9d1a7a2e53624db58149221b187b296fe
Author: Eric Danan <address@hidden>
Commit: Oleh Krehel <address@hidden>
counsel.el (counsel-org-file): Handle ATTACH_DIR property
Also list attachments from directories specified with the ATTACH_DIR rather
than the ID property.
Fixes #2042
---
counsel.el | 27 ++++++++++++---------------
1 file changed, 12 insertions(+), 15 deletions(-)
diff --git a/counsel.el b/counsel.el
index 269a19f..1355241 100644
--- a/counsel.el
+++ b/counsel.el
@@ -3311,26 +3311,23 @@ attachment directory associated with the current
buffer, all
contained files are listed, so the return value could conceivably
include attachments of other Org buffers."
(require 'org-attach)
- (let* ((ids (let (res)
- (save-excursion
- (goto-char (point-min))
- (while (re-search-forward "^:ID:[\t ]+\\(.*\\)$" nil t)
- (push (match-string-no-properties 1) res))
- (nreverse res))))
- (files
- (cl-remove-if-not
- #'file-exists-p
- (mapcar (lambda (id)
- (expand-file-name
- (concat (substring id 0 2) "/" (substring id 2))
- org-attach-directory))
- ids))))
+ (let (dirs)
+ (save-excursion
+ (goto-char (point-min))
+ (while (re-search-forward "^:\\(ATTACH_DIR\\|ID\\):[\t ]+\\(.*\\)$" nil
t)
+ (let ((dir (match-string-no-properties 2)))
+ (when (string= "ID" (match-string-no-properties 1))
+ (setq dir (expand-file-name
+ (concat (substring dir 0 2) "/" (substring dir 2))
+ org-attach-directory)))
+ (when (file-exists-p dir)
+ (push dir dirs)))))
(cl-mapcan
(lambda (dir)
(mapcar (lambda (file)
(file-relative-name (expand-file-name file dir)))
(org-attach-file-list dir)))
- files)))
+ (nreverse dirs))))
;;;###autoload
(defun counsel-org-file ()
- [elpa] master 39f5c24 187/399: ivy-test.el: Use :expected-result, (continued)
- [elpa] master 39f5c24 187/399: ivy-test.el: Use :expected-result, Oleh Krehel, 2019/07/20
- [elpa] master a9f9e41 189/399: Add counsel-descbinds-action-exec, Oleh Krehel, 2019/07/20
- [elpa] master 80d9c17 188/399: Makefile: Clone tests/ if needed, Oleh Krehel, 2019/07/20
- [elpa] master 6516265 192/399: ivy-overlay.el: Do not assume in-buffer completion, Oleh Krehel, 2019/07/20
- [elpa] master 6263d04 193/399: counsel.el (counsel-find-file): Improve mkdir action with ivy-call, Oleh Krehel, 2019/07/20
- [elpa] master 31e57e7 181/399: ivy-test.el (counsel-find-file-with-dotfiles): Disable for older Emacs, Oleh Krehel, 2019/07/20
- [elpa] master f52b0ac 175/399: ivy.el (ivy--filter): Don't cache if ivy--old-cands is empty, Oleh Krehel, 2019/07/20
- [elpa] master 2221a5c 177/399: ivy-test.el (counsel-find-file-with-dotfiles): Add test, Oleh Krehel, 2019/07/20
- [elpa] master 0467f5b 191/399: doc/ivy.org: Correct typo, Oleh Krehel, 2019/07/20
- [elpa] master e3f8908 186/399: ivy-test.el: Make friendlier, Oleh Krehel, 2019/07/20
- [elpa] master 891be1d 199/399: counsel.el (counsel-org-file): Handle ATTACH_DIR property,
Oleh Krehel <=
- [elpa] master 4f12a59 196/399: counsel.el (counsel-find-file-mkdir-action): Add trailing "/", Oleh Krehel, 2019/07/20
- [elpa] master 62a2c7e 195/399: counsel.el (counsel-find-file): Improve copy and move actions, Oleh Krehel, 2019/07/20
- [elpa] master d8136a2 200/399: doc/ivy.org: Remove outdated magit customization, Oleh Krehel, 2019/07/20
- [elpa] master ca8d5ba 197/399: ivy.el (ivy-partial): Adjust ivy-tab-space when one candidate, Oleh Krehel, 2019/07/20
- [elpa] master f28e00c 194/399: counsel.el (counsel-find-file): Improve delete action with ivy-call, Oleh Krehel, 2019/07/20
- [elpa] master afeda97 198/399: counsel.el (counsel-company): Add :caller, Oleh Krehel, 2019/07/20
- [elpa] master 3b25d30 206/399: counsel.el (counsel-compile): Add predicate to counsel-compile-env, Oleh Krehel, 2019/07/20
- [elpa] master 3d0887f 204/399: counsel.el (counsel-compile): Add counsel-compile-env, Oleh Krehel, 2019/07/20
- [elpa] master 605cee0 202/399: counsel.el (counsel-compile): Fix saving of blddir, Oleh Krehel, 2019/07/20
- [elpa] master c9f2318 203/399: counsel.el (counsel-compile): Add helper for formatting text, Oleh Krehel, 2019/07/20