Sfoglia il codice sorgente

Obsolete ‘org-at-regexp-p’.

* lisp/org.el (org-at-regexp-p): Remove, adding an obsolete function
alias.
(org-in-regexp): Tidy docstring.
(org-open-at-point):
(org-between-regexps-p):
* lisp/org-table.el (org-table-fedit-shift-reference):
(org-table-show-reference): Call ‘org-in-regexp’ instead.
Aaron Ecay 10 anni fa
parent
commit
9f75cea40d
2 ha cambiato i file con 19 aggiunte e 29 eliminazioni
  1. 9 9
      lisp/org-table.el
  2. 10 20
      lisp/org.el

+ 9 - 9
lisp/org-table.el

@@ -3730,16 +3730,16 @@ minutes or seconds."
 
 (defun org-table-fedit-shift-reference (dir)
   (cond
-   ((org-at-regexp-p "\\(\\<[a-zA-Z]\\)&")
+   ((org-in-regexp "\\(\\<[a-zA-Z]\\)&")
     (if (memq dir '(left right))
 	(org-rematch-and-replace 1 (eq dir 'left))
       (user-error "Cannot shift reference in this direction")))
-   ((org-at-regexp-p "\\(\\<[a-zA-Z]\\{1,2\\}\\)\\([0-9]+\\)")
+   ((org-in-regexp "\\(\\<[a-zA-Z]\\{1,2\\}\\)\\([0-9]+\\)")
     ;; A B3-like reference
     (if (memq dir '(up down))
 	(org-rematch-and-replace 2 (eq dir 'up))
       (org-rematch-and-replace 1 (eq dir 'left))))
-   ((org-at-regexp-p
+   ((org-in-regexp
      "\\(@\\|\\.\\.\\)\\([-+]?\\(I+\\>\\|[0-9]+\\)\\)\\(\\$\\([-+]?[0-9]+\\)\\)?")
     ;; An internal reference
     (if (memq dir '(up down))
@@ -3896,21 +3896,21 @@ With prefix ARG, apply the new formulas to the table."
 	  var name e what match dest)
       (if local (org-table-get-specials))
       (setq what (cond
-		  ((org-at-regexp-p "^@[0-9]+[ \t=]")
+		  ((org-in-regexp "^@[0-9]+[ \t=]")
 		   (setq match (concat (substring (match-string 0) 0 -1)
 				       "$1.."
 				       (substring (match-string 0) 0 -1)
 				       "$100"))
 		   'range)
-		  ((or (org-at-regexp-p org-table-range-regexp2)
-		       (org-at-regexp-p org-table-translate-regexp)
-		       (org-at-regexp-p org-table-range-regexp))
+		  ((or (org-in-regexp- org-table-range-regexp2)
+		       (org-in-regexp- org-table-translate-regexp)
+		       (org-in-regexp- org-table-range-regexp))
 		   (setq match
 			 (save-match-data
 			   (org-table-convert-refs-to-rc (match-string 0))))
 		   'range)
-		  ((org-at-regexp-p "\\$[a-zA-Z][a-zA-Z0-9]*") 'name)
-		  ((org-at-regexp-p "\\$[0-9]+") 'column)
+		  ((org-in-regexp "\\$[a-zA-Z][a-zA-Z0-9]*") 'name)
+		  ((org-in-regexp "\\$[0-9]+") 'column)
 		  ((not local) nil)
 		  (t (user-error "No reference at point")))
 	    match (and what (or match (match-string 0))))

+ 10 - 20
lisp/org.el

@@ -10700,7 +10700,7 @@ link in a property drawer line."
 	 ;; Exception: open timestamps and links in properties drawers
 	 ;; and comments.
 	 ((memq type '(comment comment-block node-property))
-	  (cond ((org-at-regexp-p org-any-link-re)
+	  (cond ((org-in-regexp org-any-link-re)
 		 (org-open-link-from-string (match-string-no-properties 0)))
 		((or (org-at-timestamp-p t) (org-at-date-range-p t))
 		 (org-follow-timestamp-link))
@@ -22147,13 +22147,13 @@ and :keyword."
     (setq clist (nreverse (delq nil clist)))
     clist))
 
-;; FIXME: Compare with at-regexp-p Do we need both?
 (defun org-in-regexp (re &optional nlines visually)
-  "Check if point is inside a match of regexp.
-Normally only the current line is checked, but you can include NLINES extra
-lines both before and after point into the search.
-If VISUALLY is set, require that the cursor is not after the match but
-really on, so that the block visually is on the match."
+  "Check if point is inside a match of RE.
+
+Normally only the current line is checked, but you can include
+NLINES extra lines after point into the search.  If VISUALLY is
+set, require that the cursor is not after the match but really
+on, so that the block visually is on the match."
   (catch 'exit
     (let ((pos (point))
           (eol (point-at-eol (+ 1 (or nlines 0))))
@@ -22164,18 +22164,8 @@ really on, so that the block visually is on the match."
 	  (if (and (<= (match-beginning 0) pos)
 		   (>= (+ inc (match-end 0)) pos))
 	      (throw 'exit (cons (match-beginning 0) (match-end 0)))))))))
-
-(defun org-at-regexp-p (regexp)
-  "Is point inside a match of REGEXP in the current line?"
-  (catch 'exit
-    (save-excursion
-      (let ((pos (point)) (end (point-at-eol)))
-	(beginning-of-line 1)
-	(while (re-search-forward regexp end t)
-	  (if (and (<= (match-beginning 0) pos)
-		   (>= (match-end 0) pos))
-	      (throw 'exit t)))
-	nil))))
+(define-obsolete-function-alias 'org-at-regexp-p 'org-in-regexp
+  "Org mode 8.3")
 
 (defun org-between-regexps-p (start-re end-re &optional lim-up lim-down)
   "Non-nil when point is between matches of START-RE and END-RE.
@@ -22196,7 +22186,7 @@ position before START-RE (resp. after END-RE)."
       (save-excursion
 	;; Point is on a block when on START-RE or if START-RE can be
 	;; found before it...
-	(and (or (org-at-regexp-p start-re)
+	(and (or (org-in-regexp start-re)
 		 (re-search-backward start-re limit-up t))
 	     (setq beg (match-beginning 0))
 	     ;; ... and END-RE after it...