Browse Source

Backport commit dfc322d77 from Emacs

* lisp/org-mobile.el (org-mobile-copy-agenda-files)
(org-mobile-update-checksum-for-capture-file):
* lisp/org-table.el (org-table-number-regexp):
Replace various combinations of [0-9a-fA-F] with [[:xdigit:]].
(Bug#36167)

Replace manually crafted hex regexes with [:xdigit:]
dfc322d77fd1ce3aa4d852e0ff07bb36944f6432
Konstantin Kharlamov
Sat Jul 6 10:54:25 2019 +0300
Konstantin Kharlamov 5 years ago
parent
commit
c0d699e9ba
2 changed files with 5 additions and 5 deletions
  1. 2 2
      lisp/org-mobile.el
  2. 3 3
      lisp/org-table.el

+ 2 - 2
lisp/org-mobile.el

@@ -486,7 +486,7 @@ agenda view showing the flagged items."
 		     (concat (shell-quote-argument org-mobile-checksum-binary)
 			     " "
 			     (shell-quote-argument (expand-file-name file)))))
-	(when (string-match "[a-fA-F0-9]\\{30,40\\}" check)
+	(when (string-match "[[:xdigit:]]\\{30,40\\}" check)
 	  (push (cons link-name (match-string 0 check))
 		org-mobile-checksum-files))))
 
@@ -775,7 +775,7 @@ If nothing new has been added, return nil."
 	 (buffer (find-file-noselect file)))
     (when buffer
       (with-current-buffer buffer
-	(when (re-search-forward (concat "\\([0-9a-fA-F]\\{30,\\}\\).*?"
+	(when (re-search-forward (concat "\\([[:xdigit:]]\\{30,\\}\\).*?"
 					 (regexp-quote org-mobile-capture-file)
 					 "[ \t]*$") nil t)
 	  (goto-char (match-beginning 1))

+ 3 - 3
lisp/org-table.el

@@ -155,7 +155,7 @@ table, obtained by prompting the user."
   :type 'string)
 
 (defcustom org-table-number-regexp
-  "^\\([<>]?[-+^.0-9]*[0-9][-+^.0-9eEdDx()%:]*\\|[<>]?[-+]?0[xX][0-9a-fA-F.]+\\|[<>]?[-+]?[0-9]+#[0-9a-zA-Z.]+\\|nan\\|[-+u]?inf\\)$"
+  "^\\([<>]?[-+^.0-9]*[0-9][-+^.0-9eEdDx()%:]*\\|[<>]?[-+]?0[xX][[:xdigit:].]+\\|[<>]?[-+]?[0-9]+#[0-9a-zA-Z.]+\\|nan\\|[-+u]?inf\\)$"
   "Regular expression for recognizing numbers in table columns.
 If a table column contains mostly numbers, it will be aligned to the
 right.  If not, it will be aligned to the left.
@@ -180,9 +180,9 @@ Other options offered by the customize interface are more restrictive."
 	  (const :tag "Exponential, Floating point, Integer"
 		 "^[-+]?[0-9.]+\\([eEdD][-+0-9]+\\)?$")
 	  (const :tag "Very General Number-Like, including hex and Calc radix"
-		 "^\\([<>]?[-+^.0-9]*[0-9][-+^.0-9eEdDx()%]*\\|[<>]?[-+]?0[xX][0-9a-fA-F.]+\\|[<>]?[-+]?[0-9]+#[0-9a-zA-Z.]+\\|nan\\|[-+u]?inf\\)$")
+		 "^\\([<>]?[-+^.0-9]*[0-9][-+^.0-9eEdDx()%]*\\|[<>]?[-+]?0[xX][[:xdigit:].]+\\|[<>]?[-+]?[0-9]+#[0-9a-zA-Z.]+\\|nan\\|[-+u]?inf\\)$")
 	  (const :tag "Very General Number-Like, including hex and Calc radix, allows comma as decimal mark"
-		 "^\\([<>]?[-+^.,0-9]*[0-9][-+^.0-9eEdDx()%]*\\|[<>]?[-+]?0[xX][0-9a-fA-F.]+\\|[<>]?[-+]?[0-9]+#[0-9a-zA-Z.]+\\|nan\\|[-+u]?inf\\)$")
+		 "^\\([<>]?[-+^.,0-9]*[0-9][-+^.0-9eEdDx()%]*\\|[<>]?[-+]?0[xX][[:xdigit:].]+\\|[<>]?[-+]?[0-9]+#[0-9a-zA-Z.]+\\|nan\\|[-+u]?inf\\)$")
 	  (string :tag "Regexp:")))
 
 (defcustom org-table-number-fraction 0.5