Browse Source

Remove references to `org-protected' `org-example' and `original-indentation'

* lisp/org-macs.el (org-if-unprotected, org-if-unprotected-1,
  org-if-unprotected-at): Removed macros.
(org-re-search-forward-unprotected): Removed function.
* lisp/org.el (org-format-latex): Remove reference to `org-protected'.
* lisp/org-list.el (org-list-struct): Remove reference to
  `org-example' and `org-protected'.
* lisp/org-footnote.el (org-footnote-at-reference-p): Remove reference
  to `org-protected'.
* lisp/org-capture.el (org-capture-fill-template): Remove reference to
  `org-protected'.
* contrib/lisp/org-wikinodes.el (org-wikinodes-process-links-for-export):
  Remove reference to `org-protected' value.

These text properties were used by the old export framework. They are
not needed anymore.
Nicolas Goaziou 12 years ago
parent
commit
73ddb3c49c
6 changed files with 37 additions and 102 deletions
  1. 23 24
      contrib/lisp/org-wikinodes.el
  2. 3 6
      lisp/org-capture.el
  3. 1 7
      lisp/org-footnote.el
  4. 3 19
      lisp/org-list.el
  5. 0 28
      lisp/org-macs.el
  6. 7 18
      lisp/org.el

+ 23 - 24
contrib/lisp/org-wikinodes.el

@@ -281,30 +281,29 @@ with working links."
 	link file)
     (goto-char (point-min))
     (while (re-search-forward re nil t)
-      (org-if-unprotected-at (match-beginning 0)
-	(unless (save-match-data
-		  (or (org-at-heading-p)
-		      (org-in-regexp org-bracket-link-regexp)
-		      (org-in-regexp org-plain-link-re)
-		      (org-in-regexp "<<[^<>]+>>")))
-	  (setq link (match-string 0))
-	  (delete-region (match-beginning 0) (match-end 0))
-	  (save-match-data
-	    (cond
-	     ((org-find-exact-headline-in-buffer link (current-buffer))
-	      ;; Found in current buffer
-	      (insert (format "[[#%s][%s]]" link link)))
-	     ((eq org-wikinodes-scope 'file)
-	      ;; No match in file, and other files are not allowed
-	      (insert (format "%s" link)))
-	     ((setq file
-		    (and (org-string-nw-p org-current-export-file)
-			 (org-wikinodes-which-file
-			  link (file-name-directory org-current-export-file))))
-	      ;; Match in another file in the current directory
-	      (insert (format "[[file:%s::%s][%s]]" file link link)))
-	     (t ;; No match for this link
-	      (insert (format "%s" link))))))))))
+      (unless (save-match-data
+		(or (org-at-heading-p)
+		    (org-in-regexp org-bracket-link-regexp)
+		    (org-in-regexp org-plain-link-re)
+		    (org-in-regexp "<<[^<>]+>>")))
+	(setq link (match-string 0))
+	(delete-region (match-beginning 0) (match-end 0))
+	(save-match-data
+	  (cond
+	   ((org-find-exact-headline-in-buffer link (current-buffer))
+	    ;; Found in current buffer
+	    (insert (format "[[#%s][%s]]" link link)))
+	   ((eq org-wikinodes-scope 'file)
+	    ;; No match in file, and other files are not allowed
+	    (insert (format "%s" link)))
+	   ((setq file
+		  (and (org-string-nw-p org-current-export-file)
+		       (org-wikinodes-which-file
+			link (file-name-directory org-current-export-file))))
+	    ;; Match in another file in the current directory
+	    (insert (format "[[file:%s::%s][%s]]" file link link)))
+	   (t ;; No match for this link
+	    (insert (format "%s" link)))))))))
 
 ;;; Hook the WikiNode mechanism into Org
 

+ 3 - 6
lisp/org-capture.el

@@ -1504,10 +1504,8 @@ The template may still contain \"%?\" for cursor positioning."
 		(setq v-i (mapconcat 'identity
 				     (org-split-string initial "\n")
 				     (concat "\n" lead))))))
-	  (replace-match
-	   (or (org-add-props (eval (intern (concat "v-" (match-string 1))))
-		   '(org-protected t)) "")
-	   t t)))
+	  (replace-match (or (eval (intern (concat "v-" (match-string 1)))) "")
+			 t t)))
 
       ;; From the property list
       (when plist-p
@@ -1523,8 +1521,7 @@ The template may still contain \"%?\" for cursor positioning."
       (let ((org-inhibit-startup t)) (org-mode))
       ;; Interactive template entries
       (goto-char (point-min))
-      (while (and (re-search-forward "%^\\({\\([^}]*\\)}\\)?\\([gGtTuUCLp]\\)?" nil t)
-		  (not (get-text-property (1- (point)) 'org-protected)))
+      (while (re-search-forward "%^\\({\\([^}]*\\)}\\)?\\([gGtTuUCLp]\\)?" nil t)
 	(unless (org-capture-escaped-%)
 	  (setq char (if (match-end 3) (match-string-no-properties 3))
 		prompt (if (match-end 2) (match-string-no-properties 2)))

+ 1 - 7
lisp/org-footnote.el

@@ -230,13 +230,7 @@ positions, and the definition, when inlined."
 				 (org-in-regexp org-bracket-link-regexp))))
 			  (and linkp (< (point) (cdr linkp))))))
 		 ;; Verify point doesn't belong to a LaTeX macro.
-		 ;; Beware though, when two footnotes are side by
-		 ;; side, once the first one is changed into LaTeX,
-		 ;; the second one might then be considered as an
-		 ;; optional argument of the command.  Thus, check
-		 ;; the `org-protected' property of that command.
-		 (or (not (org-inside-latex-macro-p))
-		     (get-text-property (1- beg) 'org-protected)))
+		 (not (org-inside-latex-macro-p)))
 	(list label beg end
 	      ;; Definition: ensure this is an inline footnote first.
 	      (and (or (not label) (match-string 1))

+ 3 - 19
lisp/org-list.el

@@ -642,8 +642,7 @@ Assume point is at an item."
       (save-excursion
 	(catch 'exit
 	  (while t
-	    (let ((ind (+ (or (get-text-property (point) 'original-indentation) 0)
-			  (org-get-indentation))))
+	    (let ((ind (org-get-indentation)))
 	      (cond
 	       ((<= (point) lim-up)
 		;; At upward limit: if we ended at an item, store it,
@@ -651,18 +650,10 @@ Assume point is at an item."
 		;; Jump to part 2.
 		(throw 'exit
 		       (setq itm-lst
-			     (if (or (not (looking-at item-re))
-				     (get-text-property (point) 'org-example))
+			     (if (not (looking-at item-re))
 				 (memq (assq (car beg-cell) itm-lst) itm-lst)
 			       (setq beg-cell (cons (point) ind))
 			       (cons (funcall assoc-at-point ind) itm-lst)))))
-	       ;; At a verbatim block, go before its beginning.  Move
-	       ;; from eol to ensure `previous-single-property-change'
-	       ;; will return a value.
-	       ((get-text-property (point) 'org-example)
-		(goto-char (previous-single-property-change
-			    (point-at-eol) 'org-example nil lim-up))
-		(forward-line -1))
 	       ;; Looking at a list ending regexp.  Dismiss useless
 	       ;; data recorded above BEG-CELL.  Jump to part 2.
 	       ((looking-at org-list-end-re)
@@ -711,8 +702,7 @@ Assume point is at an item."
       ;;    position of items in END-LST-2.
       (catch 'exit
 	(while t
-	  (let ((ind (+ (or (get-text-property (point) 'original-indentation) 0)
-			(org-get-indentation))))
+	  (let ((ind (org-get-indentation)))
 	    (cond
 	     ((>= (point) lim-down)
 	      ;; At downward limit: this is de facto the end of the
@@ -720,12 +710,6 @@ Assume point is at an item."
 	      ;; part 3.
 	      (throw 'exit
 		     (push (cons 0 (funcall end-before-blank)) end-lst-2)))
-	     ;; At a verbatim block, move to its end.  Point is at bol
-	     ;; and 'org-example property is set by whole lines:
-	     ;; `next-single-property-change' always return a value.
-	     ((get-text-property (point) 'org-example)
-	      (goto-char
-	       (next-single-property-change (point) 'org-example nil lim-down)))
 	     ;; Looking at a list ending regexp.  Save point as an
 	     ;; ending position and jump to part 3.
 	     ((looking-at org-list-end-re)

+ 0 - 28
lisp/org-macs.el

@@ -176,34 +176,6 @@ We use a macro so that the test can happen at compilation time."
   (cons (if (fboundp 'with-no-warnings) 'with-no-warnings 'progn) body))
 (def-edebug-spec org-no-warnings (body))
 
-(defmacro org-if-unprotected (&rest body)
-  "Execute BODY if there is no `org-protected' text property at point."
-  `(unless (get-text-property (point) 'org-protected)
-     ,@body))
-(def-edebug-spec org-if-unprotected (body))
-
-(defmacro org-if-unprotected-1 (&rest body)
-  "Execute BODY if there is no `org-protected' text property at point-1."
-  `(unless (get-text-property (1- (point)) 'org-protected)
-     ,@body))
-(def-edebug-spec org-if-unprotected-1 (body))
-
-(defmacro org-if-unprotected-at (pos &rest body)
-  "Execute BODY if there is no `org-protected' text property at POS."
-  `(unless (get-text-property ,pos 'org-protected)
-     ,@body))
-(def-edebug-spec org-if-unprotected-at (form body))
-(put 'org-if-unprotected-at 'lisp-indent-function 1)
-
-(defun org-re-search-forward-unprotected (&rest args)
-  "Like re-search-forward, but stop only in unprotected places."
-  (catch 'exit
-    (while t
-      (unless (apply 're-search-forward args)
-	(throw 'exit nil))
-      (unless (get-text-property (match-beginning 0) 'org-protected)
-	(throw 'exit (point))))))
-
 ;; FIXME: Normalize argument names
 (defmacro org-with-remote-undo (_buffer &rest _body)
   "Execute BODY while recording undo information in two buffers."

+ 7 - 18
lisp/org.el

@@ -17642,30 +17642,21 @@ Some of the options can be changed using the variable
 	(goto-char (point-min))
 	(while (re-search-forward re nil t)
 	  (when (and (or (not at) (equal (cdr at) (match-beginning n)))
-		     (not (get-text-property (match-beginning n)
-					     'org-protected))
 		     (or (not overlays)
 			 (not (eq (get-char-property (match-beginning n)
 						     'org-overlay-type)
 				  'org-latex-overlay))))
 	    (setq org-export-have-math t)
 	    (cond
-	     ((eq processing-type 'verbatim)
-	      ;; Leave the text verbatim, just protect it
-	      (add-text-properties (match-beginning n) (match-end n)
-				   '(org-protected t)))
+	     ((eq processing-type 'verbatim))
 	     ((eq processing-type 'mathjax)
-	      ;; Prepare for MathJax processing
+	      ;; Prepare for MathJax processing.
 	      (setq string (match-string n))
-	      (if (member m '("$" "$1"))
-		  (save-excursion
-		    (delete-region (match-beginning n) (match-end n))
-		    (goto-char (match-beginning n))
-		    (insert (org-add-props (concat "\\(" (substring string 1 -1)
-						   "\\)")
-				'(org-protected t))))
-		(add-text-properties (match-beginning n) (match-end n)
-				     '(org-protected t))))
+	      (when (member m '("$" "$1"))
+		(save-excursion
+		  (delete-region (match-beginning n) (match-end n))
+		  (goto-char (match-beginning n))
+		  (insert (concat "\\(" (substring string 1 -1) "\\)")))))
 	     ((or (eq processing-type 'dvipng)
 		  (eq processing-type 'imagemagick))
 	      ;; Process to an image
@@ -17832,8 +17823,6 @@ inspection."
 		  'org-latex-src-embed-type (if latex-frag-type
 						'paragraph 'character)))
       ;; Failed conversion.  Return the LaTeX fragment verbatim
-      (add-text-properties
-       0 (1- (length latex-frag)) '(org-protected t) latex-frag)
       latex-frag)))
 
 (defun org-create-formula-image (string tofile options buffer &optional type)