[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/org e626185 23/85: org-table.el: Fix usage of user-erro
From: |
ELPA Syncer |
Subject: |
[elpa] externals/org e626185 23/85: org-table.el: Fix usage of user-error |
Date: |
Mon, 27 Sep 2021 15:57:42 -0400 (EDT) |
branch: externals/org
commit e626185081c96b5a4af5f3223db849245b885fd5
Author: Utkarsh Singh <utkarsh190601@gmail.com>
Commit: Bastien <bzg@gnu.org>
org-table.el: Fix usage of user-error
* lisp/org-table.el (org-table-convert-region): Don't use `if' because
Elisp has no concept of continuable errors.
---
lisp/org-table.el | 88 +++++++++++++++++++++++++++----------------------------
1 file changed, 44 insertions(+), 44 deletions(-)
diff --git a/lisp/org-table.el b/lisp/org-table.el
index 639c991..0bc6687 100644
--- a/lisp/org-table.el
+++ b/lisp/org-table.el
@@ -861,52 +861,52 @@ nil When nil, the command tries to be smart and
figure out the
(let* ((beg (min beg0 end0))
(end (max beg0 end0))
re)
- (if (> (count-lines beg end) org-table-convert-region-max-lines)
- (user-error "Region is longer than `org-table-convert-region-max-lines'
(%s) lines; not converting"
- org-table-convert-region-max-lines)
- (when (equal separator '(64))
- (setq separator (read-regexp "Regexp for field separator")))
- (goto-char beg)
- (beginning-of-line 1)
- (setq beg (point-marker))
- (goto-char end)
- (if (bolp) (backward-char 1) (end-of-line 1))
- (setq end (point-marker))
- ;; Get the right field separator
- (unless separator
- (goto-char beg)
- (setq separator
- (cond
- ((not (re-search-forward "^[^\n\t]+$" end t)) '(16))
- ((not (re-search-forward "^[^\n,]+$" end t)) '(4))
- (t 1))))
+ (when (> (count-lines beg end) org-table-convert-region-max-lines)
+ (user-error "Region is longer than `org-table-convert-region-max-lines'
(%s) lines; not converting"
+ org-table-convert-region-max-lines))
+ (when (equal separator '(64))
+ (setq separator (read-regexp "Regexp for field separator")))
+ (goto-char beg)
+ (beginning-of-line 1)
+ (setq beg (point-marker))
+ (goto-char end)
+ (if (bolp) (backward-char 1) (end-of-line 1))
+ (setq end (point-marker))
+ ;; Get the right field separator
+ (unless separator
(goto-char beg)
- (if (equal separator '(4))
- (while (< (point) end)
- ;; parse the csv stuff
+ (setq separator
(cond
- ((looking-at "^") (insert "| "))
- ((looking-at "[ \t]*$") (replace-match " |") (beginning-of-line 2))
- ((looking-at "[ \t]*\"\\([^\"\n]*\\)\"")
- (replace-match "\\1")
- (if (looking-at "\"") (insert "\"")))
- ((looking-at "[^,\n]+") (goto-char (match-end 0)))
- ((looking-at "[ \t]*,") (replace-match " | "))
- (t (beginning-of-line 2))))
- (setq re (cond
- ((equal separator '(4)) "^\\|\"?[ \t]*,[ \t]*\"?")
- ((equal separator '(16)) "^\\|\t")
- ((integerp separator)
- (if (< separator 1)
- (user-error "Number of spaces in separator must be >= 1")
- (format "^ *\\| *\t *\\| \\{%d,\\}" separator)))
- ((stringp separator)
- (format "^ *\\|%s" separator))
- (t (error "This should not happen"))))
- (while (re-search-forward re end t)
- (replace-match "| " t t)))
- (goto-char beg)
- (org-table-align))))
+ ((not (re-search-forward "^[^\n\t]+$" end t)) '(16))
+ ((not (re-search-forward "^[^\n,]+$" end t)) '(4))
+ (t 1))))
+ (goto-char beg)
+ (if (equal separator '(4))
+ (while (< (point) end)
+ ;; parse the csv stuff
+ (cond
+ ((looking-at "^") (insert "| "))
+ ((looking-at "[ \t]*$") (replace-match " |") (beginning-of-line 2))
+ ((looking-at "[ \t]*\"\\([^\"\n]*\\)\"")
+ (replace-match "\\1")
+ (if (looking-at "\"") (insert "\"")))
+ ((looking-at "[^,\n]+") (goto-char (match-end 0)))
+ ((looking-at "[ \t]*,") (replace-match " | "))
+ (t (beginning-of-line 2))))
+ (setq re (cond
+ ((equal separator '(4)) "^\\|\"?[ \t]*,[ \t]*\"?")
+ ((equal separator '(16)) "^\\|\t")
+ ((integerp separator)
+ (if (< separator 1)
+ (user-error "Number of spaces in separator must be >= 1")
+ (format "^ *\\| *\t *\\| \\{%d,\\}" separator)))
+ ((stringp separator)
+ (format "^ *\\|%s" separator))
+ (t (error "This should not happen"))))
+ (while (re-search-forward re end t)
+ (replace-match "| " t t)))
+ (goto-char beg)
+ (org-table-align)))
;;;###autoload
(defun org-table-import (file separator)
- [elpa] externals/org updated (986341b -> 663255e), ELPA Syncer, 2021/09/27
- [elpa] externals/org b4ce4d6 01/85: Backport commit 25ebb9374 from Emacs, ELPA Syncer, 2021/09/27
- [elpa] externals/org d700c03 04/85: org-manual: Add referring to tables in other files, ELPA Syncer, 2021/09/27
- [elpa] externals/org d3d2e56 07/85: oc: Replace an obsolete alias, ELPA Syncer, 2021/09/27
- [elpa] externals/org 3a77e59 05/85: ox-ascii: Justify correctly with indent-tabs-mode, ELPA Syncer, 2021/09/27
- [elpa] externals/org 4271f22 10/85: org-manual: Undo the last change in Shakespeare's verse, ELPA Syncer, 2021/09/27
- [elpa] externals/org 7aeadf2 02/85: Backport commit 3f9f3ba43 from Emacs, ELPA Syncer, 2021/09/27
- [elpa] externals/org ef31364 03/85: ob-tangle: Fix incorrect buff name in org-src edit, ELPA Syncer, 2021/09/27
- [elpa] externals/org c9dc660 11/85: Fix org-babel-header-args:haskell not being an alist, ELPA Syncer, 2021/09/27
- [elpa] externals/org 527da79 18/85: Merge branch 'bugfix', ELPA Syncer, 2021/09/27
- [elpa] externals/org e626185 23/85: org-table.el: Fix usage of user-error,
ELPA Syncer <=
- [elpa] externals/org 179ae6b 25/85: Merge branch 'bugfix', ELPA Syncer, 2021/09/27
- [elpa] externals/org a3c912c 26/85: Fix duplicate logbook entry for repeated tasks, ELPA Syncer, 2021/09/27
- [elpa] externals/org 769a557 28/85: Merge branch 'bugfix', ELPA Syncer, 2021/09/27
- [elpa] externals/org 777c1c3 27/85: Merge branch 'bugfix', ELPA Syncer, 2021/09/27
- [elpa] externals/org 74a5af6 31/85: Fix byte-comp function warnings, ELPA Syncer, 2021/09/27
- [elpa] externals/org 4d1a77a 32/85: org-attach: Fix byte-comp function warning, ELPA Syncer, 2021/09/27
- [elpa] externals/org 18f6ef8 33/85: ox.el: add smart quotes for greek, ELPA Syncer, 2021/09/27
- [elpa] externals/org 1c83f6f 47/85: Allow sexps with nested parenthesis in org-agenda-prefix-format, ELPA Syncer, 2021/09/27
- [elpa] externals/org d3d80c5 46/85: Add test checking org-log-done specs, ELPA Syncer, 2021/09/27
- [elpa] externals/org df51e93 53/85: Merge branch 'bugfix', ELPA Syncer, 2021/09/27