Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make org-download-edit work with org-attach-directories #180

Open
codygman opened this issue Oct 18, 2021 · 0 comments · May be fixed by #182
Open

Make org-download-edit work with org-attach-directories #180

codygman opened this issue Oct 18, 2021 · 0 comments · May be fixed by #182

Comments

@codygman
Copy link

codygman commented Oct 18, 2021

No time for a PR and I bet someone uses the shell-expansion I removed, so this is just to gauge interest and give others that need it a solution as a start:

(defun org-download-edit ()
  "Open the image at point for editing."
  (interactive)
  (let ((context (org-element-context)))
    (if (not (eq (car-safe context) 'link))
        (user-error "Not on a link")
      (let* ((filename (url-unhex-string (plist-get (cadr (org-element-context)) :path)))
	     (filepath (org-attach-expand filename)))
	(start-process-shell-command
	 "org-download-edit"
	 "org-download-edit"
	 (format org-download-edit-cmd filepath))))))

In my config I now have:

(defun my/org-download-edit ()
    "Open the image at point for editing."
    (interactive)
    (let ((context (org-element-context)))
      (if (not (eq (car-safe context) 'link))
          (user-error "Not on a link")
        (let* ((filename (url-unhex-string (plist-get (cadr (org-element-context)) :path)))
               (filepath (org-attach-expand filename)))
          (start-process-shell-command
           "org-download-edit"
           "org-download-edit"
           (format org-download-edit-cmd filepath))))))
  
  (advice-add 'org-download-edit :override
              'my/org-download-edit)
floli added a commit to floli/org-download that referenced this issue Oct 25, 2021
Closes abo-abo#180.

Also enclose the process buffer in asterisk, which is common practice.
@floli floli linked a pull request Oct 25, 2021 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant