From 8fe6f275121ec9eaee6fd6caa9a26c609fd59379 Mon Sep 17 00:00:00 2001 From: Nicolas Goaziou Date: Mon, 18 Jul 2016 23:43:01 +0200 Subject: [PATCH] Deprecate "file+application" link types * doc/org.texi (External links): Remove "file+emacs" and "file+sys" syntax. * lisp/org-compat.el (org): Support "file+emacs" and "file+sys" for the time being. * lisp/org-lint.el (org-lint--checkers): Add checker for obsolete link types. (org-lint-file-application): New function. * lisp/org.el (org-link-parameters): Remove deprecated link types. --- doc/org.texi | 2 -- etc/ORG-NEWS | 5 ++++- lisp/org-compat.el | 7 +++++++ lisp/org-lint.el | 15 ++++++++++++++- lisp/org.el | 2 -- 5 files changed, 25 insertions(+), 6 deletions(-) diff --git a/doc/org.texi b/doc/org.texi index 81bff5ffa..24c0cb12d 100644 --- a/doc/org.texi +++ b/doc/org.texi @@ -3554,8 +3554,6 @@ file}@footnote{ Headline searches always match the exact headline, ignoring spaces and cookies. If the headline is not found and the value of the option @code{org-link-search-must-match-exact-headline} is @code{query-to-create}, then the user will be queried to create it.} -file+sys:/path/to/file @r{open via OS, like double-click} -file+emacs:/path/to/file @r{force opening by Emacs} docview:papers/last.pdf::NNN @r{open in doc-view mode at page} id:B7423F4D-2E8A-471B-8810-C40F074717E9 @r{Link to heading by ID} news:comp.emacs @r{Usenet link} diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS index 01e1ce11d..2535a0964 100644 --- a/etc/ORG-NEWS +++ b/etc/ORG-NEWS @@ -485,7 +485,10 @@ now shift to the first possible future occurrence, even if the occurrence is later the same day the task is completed. (Timestamps already in the future are still shifted one time further into the future.) - +*** ~file+emacs~ and ~file+sys~ link types are deprecated +They are still supported in Org 9.0 but will eventually be removed in +a later release. Use ~file~ link type along with universal arguments +to force opening it in either Emacs or with system application. * Version 8.3 ** Incompatible changes diff --git a/lisp/org-compat.el b/lisp/org-compat.el index 5dd3d4080..0675d5bc2 100644 --- a/lisp/org-compat.el +++ b/lisp/org-compat.el @@ -226,6 +226,13 @@ See `org-link-parameters' for documentation on the other parameters." (make-obsolete 'org-add-link-type "org-link-add." "Org 9.0") +;;;; Obsolete link types + +(with-eval-after-load 'org + (org-link-set-parameters "file+emacs") ;since Org 9.0 + (org-link-set-parameters "file+sys")) ;since Org 9.0 + + ;;; Miscellaneous functions diff --git a/lisp/org-lint.el b/lisp/org-lint.el index feb709050..444ab8032 100644 --- a/lisp/org-lint.el +++ b/lisp/org-lint.el @@ -96,6 +96,7 @@ ;; - incomplete drawers ;; - indented diary-sexps ;; - obsolete QUOTE section +;; - obsolete "file+application" link ;;; Code: @@ -273,7 +274,11 @@ :name 'quote-section :description "Report obsolete QUOTE section" :categories '(obsolete) - :trust 'low)) + :trust 'low) + (make-org-lint-checker + :name 'file-application + :description "Report obsolete \"file+application\" link" + :categories '(link obsolete))) "List of all available checkers.") (defun org-lint--collect-duplicates @@ -849,6 +854,14 @@ Use \"export %s\" instead" (list (org-element-property :begin h) "Deprecated QUOTE section")))))) +(defun org-lint-file-application (ast) + (org-element-map ast 'link + (lambda (l) + (let ((app (org-element-property :application l))) + (and app + (list (org-element-property :begin l) + (format "Deprecated \"file+%s\" link type" app))))))) + (defun org-lint-wrong-header-argument (ast) (let* ((reports) (verify diff --git a/lisp/org.el b/lisp/org.el index b1f632f40..8bbaec8c2 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -1762,8 +1762,6 @@ The value of this is taken from the #+LINK lines.") '(("doi" :follow org--open-doi-link) ("elisp" :follow org--open-elisp-link) ("file" :complete org-file-complete-link) - ("file+emacs") - ("file+sys") ("ftp" :follow (lambda (path) (browse-url (concat "ftp:" path)))) ("help" :follow org--open-help-link) ("http" :follow (lambda (path) (browse-url (concat "http:" path))))