Commit Graph

324 Commits

Author SHA1 Message Date
Marco Wahl 28da0649e6 org-attach: Extend range for org-attach-commands
* lisp/org-attach.el (org-attach): Get rid of the use of the second
arg of `commandp`, by making `org-attach-commands` accept any
commands (including keyboard macros).

Patch from Stefan Monnier.
https://list.orgmode.org/jwvwni7y70r.fsf-monnier+emacs@gnu.org/
2022-02-06 23:57:14 +01:00
Marco Wahl 4fdfe9c584 org-attach: Clean up some magic numbers
* lisp/org-attach.el (org-attach): Clean up some magic numbers.

Patch from Stefan Monnier.
https://list.orgmode.org/jwvwni7y70r.fsf-monnier+emacs@gnu.org/
2022-02-06 23:48:32 +01:00
Kyle Meyer aae2ac3a68 Merge branch 'bugfix' 2022-01-01 15:21:37 -05:00
Kyle Meyer 5a229cbc44 Update copyright year to 2022 2022-01-01 15:17:08 -05:00
Nicholas Vollmer fac96da572 org-attach.el: Fix checkdoc warnings
* org-attach.el: Fix checkdoc warnings.
2021-10-02 19:15:52 +02:00
Bastien 806ac1b7f6 *el: Fix indentation 2021-09-29 09:22:47 +02:00
Nicholas Vollmer 4d1a77aec6 org-attach: Fix byte-comp function warning
* (org-attach.el): Declare function for byte compiler.
2021-09-25 22:46:34 +02:00
Stefan Kangas 51cdd6e30f Various minor docfixes found by checkdoc 2021-09-16 21:24:59 +02:00
Marco Wahl 81eb8c5f9e attach: Fix for Emacs<28
* lisp/org-compat.el: Introduce org-directory-empty-p which is directory-empty-p from Emacs 28.
* lisp/org-attach.el (org-attach-sync): Use org-directory-empty-p instead of directory-empty-p.
* etc/ORG-NEWS: Note about org-directory-empty-p.

Thanks Kyle identifying the issue.  Thanks Arthur for suggesting a
fix.
2021-08-10 22:20:48 +02:00
Marco Wahl 61e0837325 org-attach: Possibly delete empty attach directory
* lisp/org-attach.(org-attach-sync): Enable possible deletion of empty
attachment directories.  `org-attach-sync-delete-empty-dir' controls
the action: Never delete, Always delete or Query the user (default).
2021-07-09 21:03:44 +02:00
Kyle Meyer e0fb2339f4 Merge branch 'km/from-emacs-master'
Porting from Emacs's master to Org's maint branch has been on hold
leading up to the Emacs 27.2 release to avoid any required fixup syncs
carrying those commits into the emacs-27 branch.  This merge brings
those changes into master.  The km/from-emacs-master branch should be
merged to maint when Emacs 27.2 has been released (assuming Org 9.5
hasn't been released, in which case maint will be tracking 9.5.x and
already include these changes).
2021-02-14 18:06:23 -05:00
Stefan Kangas d904f9e5da Backport commit f88a7897a from Emacs
* lisp/ob-R.el (org-babel-R-write-object-command):
* lisp/org-attach.el (org-attach-after-change-hook):
* lisp/org.el (org-stamp-time-of-day-regexp): Shorten doc strings to
not exceed 80-column limits.  (Bug#44858)

Shorten over-wide docstrings in variables
f88a7897a80ee9129bdc444cafff32d026c4b6d8
Stefan Kangas
Sat Dec 19 18:21:06 2020 +0100
2021-02-14 17:38:07 -05:00
Kyle Meyer 291993888d Merge branch 'maint' 2021-01-01 15:02:10 -05:00
Kyle Meyer 99eafe3787 Update copyright year to 2021 2021-01-01 14:59:01 -05:00
Kyle Meyer d631a51e01 org-attach: Silence byte-compiler
de6d90224 (org-attach: Consider inlinetasks when calculating attach
dir, 2020-12-17) introduced a call to org-inlinetask-goto-beginning
and org-inlinetask-in-task-p, each behind a featurep guard.
2020-12-23 00:05:39 -05:00
Ihor Radchenko de6d90224c org-attach: Consider inlinetasks when calculating attach dir
* lisp/org-attach.el (org-attach): When inside inlinetask, return
attachment dir of that task.  When outside inlinetask, return
attachment dir of the main task ignoring any inlinetasks above point.

The call to `org-back-to-heading-or-point-min` does not move point to
the actual heading when there is inlinetask above the point.  The
result is incorrect return value or even creation of property drawer
below *...** END line of the last inline task before point.
2020-12-17 07:26:31 +01:00
Kyle Meyer eac255d911 Merge branch 'maint' 2020-07-08 00:12:06 -04:00
Kyle Meyer e62ca4a1bf org-attach: Fix :type for org-attach-use-inheritance
* lisp/org-attach.el (org-attach-use-inheritance): Drop repeated :type
keyword that incorrectly marked the option as boolean.

Reported-by: Philip Blagoveschensky <philip@crabman.me>
https://orgmode.org/list/7036d668-eb09-ba4d-0b46-503fbc4a50ce@crabman.me
2020-07-08 00:11:34 -04:00
Kyle Meyer 0a8faecb7f Merge branch 'maint' 2020-03-05 23:24:24 -05:00
Tim Visher 70c1eec559 org-attach.el: Use `force' arg everywhere in `org-attach-delete-all'
* lisp/org-attach.el (org-attach-delete-all): Use `force' arg
throughout function.

`org-attach-delete-all` advertised a `force` option but passing it
only forced its way past the initial "Really remove all…" query.  This
was unexpected and not properly documented.

This extends the use of the `force` argument to the `delete-directory`
call and documents its meaning in the docstring.

TINYCHANGE
2020-03-05 23:24:14 -05:00
Nicolas Goaziou 041138e47c Remove `org-export-link-as-file'
* lisp/ol.el (org-link-parameters): Remove reference to the function.
* lisp/ox.el (org-export-link-as-file): Remove function.
* testing/lisp/test-ox.el (test-org-export/link-as-file): Remove test.

The current implementation is not satisfactory, and not useful in the
code base. Using a pre-export hook turning custom link type into
"file" is enough for now. See "attachement" links for an example.
2020-02-28 01:30:30 +01:00
Gustav Wikström 0e0df5abf3 attach: translate directly as file links during export
* lisp/org-attach.el (org-attach-expand-links): translate directly as
file links during export.
2020-02-28 01:27:47 +01:00
Nicolas Goaziou 42ec2462a0 Do not leak "attachment" links
* lisp/ol.el (org-link-open): Remove "attachment" for special cases.
* lisp/org-attach.el (org-attach-expand-links):
(org-attach-follow): New functions.
(org-attach-link-expand): Remove function.
* lisp/org-element.el (org-element-link-parser):
* lisp/ox-ascii.el (org-ascii-link):
* lisp/ox-html.el (org-html-link):
* lisp/ox-latex.el (org-latex--inline-image):
(org-latex-link):
* lisp/ox-man.el (org-man-link):
* lisp/ox-md.el (org-md-link):
* lisp/ox-odt.el (org-odt-inline-image-rules):
(org-odt-link):
* lisp/ox-texinfo.el (org-texinfo-inline-image-rules):
(org-texinfo-link): Remove "attachment" from special cases.
2020-02-22 14:22:49 +01:00
Bastien 5dd7721242 Use `org-switch-to-buffer-other-window' in a few places
* lisp/org-src.el (org-src-switch-to-buffer):
* lisp/org-attach.el (org-attach):
* lisp/ob-lilypond.el (org-babel-lilypond-execute-tangled-ly)
(org-babel-lilypond-mark-error-line): Use
`org-switch-to-buffer-other-window' instead of
`switch-to-buffer-other-window'.
2020-02-17 09:04:19 +01:00
Kyle Meyer ea94a0da43 Merge branch 'maint' 2020-02-13 00:04:16 -05:00
Alan Mackenzie 5056a48ff5 Backport commit 530067463 from Emacs
* lisp/org-attach.el (org-attach-unset-directory): Replace "different
than" by "different from".

Correct "different than" to "different from" where appropriate
530067463bffc982f02dcc4f2805d389704575b4
Alan Mackenzie
Sun Feb 9 14:33:14 2020 +0000
2020-02-13 00:03:19 -05:00
Bastien 76ac192c4f Fix previous commit 2020-02-12 09:36:04 +01:00
Bastien 04e9d848ed Fix org-attach dispatch enhancement 2020-02-12 09:24:33 +01:00
Bastien fe46c02afa Fix code typo in commit 2508dfa6 2020-02-11 23:52:00 +01:00
Bastien 2508dfa644 Factor out org-scroll and use it in ox.el, org-agenda/attach.el
* lisp/ox.el (org-export--dispatch-ui): Update message in the
header line to promote the use of C-v and M-v while SPC and
DEL are still allowed for backward compatibility reasons.

* lisp/org-macs.el (org-scroll): New function.

* lisp/org-attach.el (org-attach): Use `org-scroll'.

* lisp/org-agenda.el (org-agenda-get-restriction-and-command):
Allow C-v, M-v, C-n and C-p to scroll.

This change adverize C-v, M-v, C-n and C-p as the default keys
for scrolling the window, while SPC and DEL are still available
in the export dispatch window.

In particular, don't use SPC as a way to scroll the window in
the agenda commands dispatch window, as this key might be used
for a custom agenda command.
2020-02-11 01:04:28 +01:00
Gustav Wikström a24c8c481f Refactor attachment path expansion
* lisp/org-attach.el (org-attach-link-expand): New function for link
  element expansion.

* lisp/org-element.el (org-element-link-parser): Remove info about
  expanded attachment paths from link elements.

* lisp/ol.el (org-link-open)
* lisp/ox-texinfo.el (org-texinfo-link)
* lisp/ox-odt.el (org-odt-link)
* lisp/ox-md.el (org-md-link)
* lisp/ox-man.el (org-man-link)
* lisp/ox-latex.el (org-latex--inline-image, org-latex-link)
* lisp/ox-html.el (org-html-link)
* lisp/ox-ascii.el (org-ascii-link): Refactor to use new link
  expansion function from org-attach.el instead of (now removed)
  custom link property from org-element.el.
2020-02-06 22:09:18 +01:00
Bastien 6f02fa596a Merge branch 'maint' 2020-01-27 14:55:50 +01:00
Bastien e982108445 Fix "Maintainer: " entry in the header
* lisp/org.el:
* lisp/org-table.el:
* lisp/org-list.el:
* lisp/org-attach.el:
* lisp/org-agenda.el: Fix "Maintainer: " entry in the header.
2020-01-27 14:55:15 +01:00
Bastien f603039884 Merge branch 'maint' 2020-01-26 19:16:18 +01:00
Bastien 47b1042c4c org-attach.el: Tiny formatting fix
* lisp/org-attach.el (org-attach-attach): Tiny formatting fix.
2020-01-26 19:16:01 +01:00
Bastien 933a9ee993 org-attach.el: Enhance dispatch buffer navigation
* lisp/org-attach.el (org-attach): Enhance dispatch buffer
navigation.

Thanks to Vladimir Nikishkin for raising this issue.
2020-01-26 19:05:08 +01:00
Bastien 389875c495 Merge branch 'maint' 2020-01-26 16:33:29 +01:00
Bastien 3399918691 Add maintainer 2020-01-26 12:59:55 +01:00
Gustav Wikström edefb2835d Additional option for org-attach-store-link-p
* doc/org-manual.org (Attachment options)
* etc/ORG-NEWS (New option in ~org-attach-store-link-p~)
* lisp/org-attach.el (org-attach-store-link-p)
  (org-attach-attach): Add option to store a link to the attached file
  with a file link.
2020-01-19 10:50:14 +01:00
Gustav Wikström f0ce4a6357 org-attach: variable name change
* lisp/org-attach.el (org-attach-attach): Change variable name only
  for the point of better semantics
2020-01-19 10:50:14 +01:00
Gustav Wikström 20d293b4aa Give link parser knowledge of attachment link expanded path
* lisp/org-element.el (org-element-link-parser): Add info about
  expanded attachment paths to the link parse tree export.

* lisp/org-attach.el Remove org-attach-open-link.  Let attachment
  links use the built in code that already is developed for file
  links.

* lisp/ol.el (org-link-open): Add knowledge about attachment links to
  the function opening links, so they can be opened exactly as file
  links are opened.

* lisp/ox-texinfo.el (org-texinfo-link)
* lisp/ox-odt.el (org-odt-link)
* lisp/ox-md.el (org-md-link)
* lisp/ox-man.el (org-man-link)
* lisp/ox-latex.el (org-latex--inline-image, org-latex-link)
* lisp/ox-html.el (org-html-link)
* lisp/ox-ascii.el (org-ascii-link): Refactor to use property from
  link parser instead of invoking attachment expansion in the
  exporter.
2020-01-18 01:41:01 +01:00
Gustav Wikström d70db54dbc Improve attachment link export functionality
Make attachment links export just as file links.

* lisp/ox-ascii.el
* lisp/ox-html.el
* lisp/ox-latex.el
* lisp/ox-man.el
* lisp/ox-md.el
* lisp/ox-texinfo.el
* lisp/org-attach.el: Move export functionality for attachment links
  into the respective export backend, for feature parity with file
  links.
2020-01-14 04:15:38 +01:00
Kyle Meyer 93c11da002 Merge branch 'maint' 2020-01-01 13:39:26 -05:00
Kyle Meyer ff5fc050d3 Update copyright year to 2020 2020-01-01 13:38:46 -05:00
Nicolas Goaziou 0a82c8370d org-attach: Tiny refactoring
* lisp/org-attach.el (org-attach): Use `org-with-point-at'.
2019-12-15 19:08:07 +01:00
Gustav Wikström 26ace90042 Make org-attach store links using attachment-links
* lisp/org-attach.el (org-attach-attach): Storing links using the new
  attachment link type instead of file links.

* lisp/org-compat.el (org-attach-store-link, org-attach-expand-link):
  Remove not needed functions and mark them as obsolete for easier
  future reference.
2019-12-13 23:01:10 +01:00
Kyle Meyer 955e531d24 Merge branch 'maint' 2019-12-11 21:24:45 -05:00
Paul Eggert f9a55cba31 Backport commit b0f20651e from Emacs
; Spelling fixes
b0f20651e3cbb8a66f11ffae4c18634019c20cd4
Paul Eggert
Tue Dec 10 20:05:49 2019 -0800
2019-12-11 21:22:50 -05:00
Gustav Wikström cffe44ba94 Merge branch 'master' into next 2019-10-21 14:58:39 +02:00
Gustav Wikström 42b8db0d34 Improve handling of org attach id to path functions
* doc/org-manual.org (Attachment options)
* etc/ORG-NEWS (Org-Attach has been refactored and extended)
(New ID method based on timestamp)
* lisp/org-attach.el (org-attach-id-uuid-folder-format)
(org-attach-id-ts-folder-format)
(org-attach-id-to-path-function-list, org-attach-dir)
(org-attach-dir-from-id): Better handling of id to path
functionality. At the same time adding an id-to-path function
for timestamp-based ID that easily can be promoted to the
primary function by customization of the user.
2019-10-20 02:49:48 +02:00