فهرست منبع

Deprecate org-remove-(angle-brackets,double-quotes)

* lisp/org.el (org-remove-angle-brackets, org-remove-double-quotes):
Deprecate.
* lisp/org-gnus.el (org-gnus-store-link):
* lisp/org-lint.el (org-lint-non-existent-setupfile-parameter):
(org-lint-wrong-include-link-parameter):
* lisp/org-macro.el (org-macro--collect-macros):
* lisp/org-mhe.el (org-mhe-store-link):
* lisp/org-rmail.el (org-rmail-store-link):
* lisp/org.el (org--setup-collect-keywords):
(org-insert-link):
(org-translate-link-from-planner):
(org-offer-links-in-entry):
* lisp/ox-publish.el (org-publish-cache-file-needs-publishing):
* lisp/ox.el (org-export--get-inbuffer-options):
(org-export--list-bound-variables):
(org-export-expand-include-keyword): Replace with `org-unbracket-string'.
Aaron Ecay 8 سال پیش
والد
کامیت
6e3ff4acc5
8فایلهای تغییر یافته به همراه22 افزوده شده و 26 حذف شده
  1. 2 2
      lisp/org-gnus.el
  2. 3 2
      lisp/org-lint.el
  3. 1 2
      lisp/org-macro.el
  4. 1 1
      lisp/org-mhe.el
  5. 1 1
      lisp/org-rmail.el
  6. 9 13
      lisp/org.el
  7. 2 1
      lisp/ox-publish.el
  8. 3 4
      lisp/ox.el

+ 2 - 2
lisp/org-gnus.el

@@ -159,7 +159,7 @@ If `org-store-link' was called with a prefix arg the meaning of
 	   (header (with-current-buffer gnus-summary-buffer
 		     (gnus-summary-article-header)))
 	   (from (mail-header-from header))
-	   (message-id (org-remove-angle-brackets (mail-header-id header)))
+	   (message-id (org-unbracket-string "<" ">" (mail-header-id header)))
 	   (date (org-trim (mail-header-date header)))
 	   (subject (copy-sequence (mail-header-subject header)))
 	   (to (cdr (assq 'To (mail-header-extra header))))
@@ -202,7 +202,7 @@ If `org-store-link' was called with a prefix arg the meaning of
         (let ((gcc (car (last
                          (message-unquote-tokens
                           (message-tokenize-header (mail-fetch-field "gcc" nil t) " ,")))))
-              (id (org-remove-angle-brackets (mail-fetch-field "Message-ID")))
+              (id (org-unbracket-string "<" ">" (mail-fetch-field "Message-ID")))
               (to (mail-fetch-field "To"))
               (from (mail-fetch-field "From"))
               (subject (mail-fetch-field "Subject"))

+ 3 - 2
lisp/org-lint.el

@@ -552,7 +552,8 @@ Use :header-args: instead"
   (org-element-map ast 'keyword
     (lambda (k)
       (when (equal (org-element-property :key k) "SETUPFILE")
-	(let ((file (org-remove-double-quotes
+	(let ((file (org-unbracket-string
+		     "\"" "\""
 		     (org-element-property :value k))))
 	  (and (not (file-remote-p file))
 	       (not (file-exists-p file))
@@ -567,7 +568,7 @@ Use :header-args: instead"
 	       (path
 		(and (string-match "^\\(\".+\"\\|\\S-+\\)[ \t]*" value)
 		     (save-match-data
-		       (org-remove-double-quotes (match-string 1 value))))))
+		       (org-unbracket-string "\"" "\"" (match-string 1 value))))))
 	  (if (not path)
 	      (list (org-element-property :post-affiliated k)
 		    "Missing location argument in INCLUDE keyword")

+ 1 - 2
lisp/org-macro.el

@@ -58,7 +58,6 @@
 (declare-function org-element-type "org-element" (element))
 (declare-function org-file-contents "org" (file &optional noerror))
 (declare-function org-mode "org" ())
-(declare-function org-remove-double-quotes "org" (s))
 (declare-function vc-backend "vc-hooks" (f))
 (declare-function vc-call "vc-hooks" (fun file &rest args) t)
 (declare-function vc-exec-after "vc-dispatcher" (code))
@@ -104,7 +103,7 @@ Return an alist containing all macro templates found."
 				   (push (cons name template) templates))))
 			   ;; Enter setup file.
 			   (let ((file (expand-file-name
-					(org-remove-double-quotes val))))
+					(org-unbracket-string "\"" "\"" val))))
 			     (unless (member file files)
 			       (with-temp-buffer
 				 (setq default-directory

+ 1 - 1
lisp/org-mhe.el

@@ -92,7 +92,7 @@ supported by MH-E."
 			      :subject subject :message-id message-id)
 	(setq desc (org-email-link-description))
 	(setq link (concat "mhe:" (org-mhe-get-message-real-folder) "#"
-			   (org-remove-angle-brackets message-id)))
+			   (org-unbracket-string "<" ">" message-id)))
 	(org-add-link-props :link link :description desc)
 	link))))
 

+ 1 - 1
lisp/org-rmail.el

@@ -68,7 +68,7 @@
 	  (org-store-link-props
 	   :type "rmail" :from from :to to :date date
 	   :subject subject :message-id message-id)
-	  (setq message-id (org-remove-angle-brackets message-id))
+	  (setq message-id (org-unbracket-string "<" ">" message-id))
 	  (setq desc (org-email-link-description))
 	  (setq link (concat "rmail:" folder "#" message-id))
 	  (org-add-link-props :link link :description desc)

+ 9 - 13
lisp/org.el

@@ -5307,7 +5307,7 @@ Return value contains the following keys: `archive', `category',
 	       (unless buffer-read-only ; Do not check in Gnus messages.
 		 (let ((f (and (org-string-nw-p value)
 			       (expand-file-name
-				(org-remove-double-quotes value)))))
+				(org-unbracket-string "\"" "\"" value)))))
 		   (when (and f (file-readable-p f) (not (member f files)))
 		     (with-temp-buffer
 		       (setq default-directory (file-name-directory f))
@@ -10429,7 +10429,7 @@ be used as the default description."
       ;; Convert to bracket link
       (setq remove (list (match-beginning 0) (match-end 0))
 	    link (read-string "Link: "
-			      (org-remove-angle-brackets (match-string 0)))))
+			      (org-unbracket-string "<" ">" (match-string 0)))))
      ((member complete-file '((4) (16)))
       ;; Completing read for file names.
       (setq link (org-file-complete-link complete-file)))
@@ -10494,7 +10494,7 @@ Use TAB to complete link prefixes, then RET for type-specific completion support
     (when (and (string-match org-plain-link-re link)
 	       (not (string-match org-ts-regexp link)))
       ;; URL-like link, normalize the use of angular brackets.
-      (setq link (org-remove-angle-brackets link)))
+      (setq link (org-unbracket-string "<" ">" link)))
 
     ;; Check if we are linking to the current file with a search
     ;; option If yes, simplify the link by using only the search
@@ -10668,7 +10668,7 @@ This is still an experimental function, your mileage may vary."
     ;; A typical message link.  Planner has the id after the final slash,
     ;; we separate it with a hash mark
     (setq path (concat (match-string 1 path) "#"
-		       (org-remove-angle-brackets (match-string 2 path))))))
+		       (org-unbracket-string "<" ">" (match-string 2 path))))))
   (cons type path))
 
 (defun org-find-file-at-mouse (ev)
@@ -10996,7 +10996,7 @@ there is one, return it."
 		 (cond
 		  ((not (string-match org-bracket-link-regexp l))
 		   (princ (format "[%c]  %s\n" (cl-incf cnt)
-				  (org-remove-angle-brackets l))))
+				  (org-unbracket-string "<" ">" l))))
 		  ((match-end 3)
 		   (princ (format "[%c]  %s (%s)\n" (cl-incf cnt)
 				  (match-string 3 l) (match-string 1 l))))
@@ -11345,20 +11345,16 @@ or to another Org file, automatically push the old position onto the ring."
     (goto-char m)
     (when (or (outline-invisible-p) (org-invisible-p2)) (org-show-context 'mark-goto))))
 
-;;; TODO: Use string-remove-prefix and -suffix once we only support
-;;; Emacs 24.4+
 (defun org-remove-angle-brackets (s)
-  (when (equal (substring s 0 1) "<") (setq s (substring s 1)))
-  (when (equal (substring s -1) ">") (setq s (substring s 0 -1)))
-  s)
+  (org-unbracket-string "<" ">" s))
+(make-obsolete 'org-remove-angle-brackets 'org-unbracket-string "Org 9.0")
 (defun org-add-angle-brackets (s)
   (unless (equal (substring s 0 1) "<") (setq s (concat "<" s)))
   (unless (equal (substring s -1) ">") (setq s (concat s ">")))
   s)
 (defun org-remove-double-quotes (s)
-  (when (equal (substring s 0 1) "\"") (setq s (substring s 1)))
-  (when (equal (substring s -1) "\"") (setq s (substring s 0 -1)))
-  s)
+  (org-unbracket-string "\"" "\"" s))
+(make-obsolete 'org-remove-double-quotes 'org-unbracket-string "Org 9.0")
 
 ;;; Following specific links
 

+ 2 - 1
lisp/ox-publish.el

@@ -1218,7 +1218,8 @@ the file including them will be republished as well."
 			       "\\`\\(\".+?\"\\|\\S-+\\)\\(?:\\s-+\\|$\\)"
 			       value)
                               (let ((m (match-string 1 value)))
-                                (org-remove-double-quotes
+                                (org-unbracket-string
+				 "\"" "\""
 				 ;; Ignore search suffix.
                                  (if (string-match "\\(::\\(.*?\\)\\)\"?\\'" m)
                                      (substring m 0 (match-beginning 0))

+ 3 - 4
lisp/ox.el

@@ -1474,7 +1474,7 @@ Assume buffer is in Org mode.  Narrowing, if any, is ignored."
 			  ((equal key "SETUPFILE")
 			   (let ((file
 				  (expand-file-name
-				   (org-remove-double-quotes (org-trim val)))))
+				   (org-unbracket-string "\"" "\"" (org-trim val)))))
 			     ;; Avoid circular dependencies.
 			     (unless (member file files)
 			       (with-temp-buffer
@@ -1621,7 +1621,7 @@ an alist where associations are (VARIABLE-NAME VALUE)."
 			       (push (read (format "(%s)" val)) alist)
 			     ;; Enter setup file.
 			     (let ((file (expand-file-name
-					  (org-remove-double-quotes val))))
+					  (org-unbracket-string "\"" "\"" val))))
 			       (unless (member file files)
 				 (with-temp-buffer
 				   (setq default-directory
@@ -3289,8 +3289,7 @@ storing and resolving footnotes.  It is created automatically."
 				 (setq matched
 				       (replace-match "" nil nil matched 1)))
 			       (expand-file-name
-				(org-remove-double-quotes
-				 matched)
+				(org-unbracket-string "\"" "\"" matched)
 				dir)))
 			 (setq value (replace-match "" nil nil value)))))
 		 (only-contents