Browse Source

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.
Nicolas Goaziou 8 years ago
parent
commit
8fe6f27512
5 changed files with 25 additions and 6 deletions
  1. 0 2
      doc/org.texi
  2. 4 1
      etc/ORG-NEWS
  3. 7 0
      lisp/org-compat.el
  4. 14 1
      lisp/org-lint.el
  5. 0 2
      lisp/org.el

+ 0 - 2
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}

+ 4 - 1
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

+ 7 - 0
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
 

+ 14 - 1
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

+ 0 - 2
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))))