[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] master 3745d8b 3/4: [org-translate] Do a better job of reporting

From: Eric Abrahamsen
Subject: [elpa] master 3745d8b 3/4: [org-translate] Do a better job of reporting errors at startup
Date: Fri, 16 Oct 2020 01:36:22 -0400 (EDT)

branch: master
commit 3745d8bc09765607e69af1031f3f7690360a303b
Author: Eric Abrahamsen <eric@ericabrahamsen.net>
Commit: Eric Abrahamsen <eric@ericabrahamsen.net>

    [org-translate] Do a better job of reporting errors at startup
    * packages/org-translate/org-translate.el (org-translate-mode): If the
    mode fails to start because the buffer is not set up correctly, which
    is highly likely, the user needs to know that.
 packages/org-translate/org-translate.el | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/packages/org-translate/org-translate.el 
index 0b908c1..588ab77 100644
--- a/packages/org-translate/org-translate.el
+++ b/packages/org-translate/org-translate.el
@@ -330,9 +330,10 @@ By default, just remove it."
              ogt-glossary-heading nil
              ogt-segmentation-strategy nil
              ogt-segmentation-character nil
-             ogt-glossary-table nil)
-       (move-marker ogt-probable-source-location nil)
-       (delete-overlay ogt-source-segment-overlay))
+             ogt-glossary-table nil
+             ogt-probable-source-location nil)
+       (when (overlayp ogt-source-segment-overlay)
+         (delete-overlay ogt-source-segment-overlay)))
     (unless (derived-mode-p 'org-mode)
       (user-error "Only applicable in Org files."))
     (let* ((this-project (or ogt-this-project-name
@@ -345,7 +346,7 @@ By default, just remove it."
           (this-plist (when this-project
                         (alist-get this-project ogt-translation-projects))))
-      (condition-case nil
+      (condition-case err
          (setq ogt-source-heading (or (plist-get this-plist :source)
@@ -362,7 +363,8 @@ By default, just remove it."
                ogt-glossary-table (make-hash-table :size 500 :test #'equal)
                ogt-probable-source-location (make-marker)
                ogt-source-segment-overlay (make-overlay (point) (point)))
-       (error (org-translate-mode -1)))
+       (error (org-translate-mode -1)
+              (signal (car err) (cdr err))))
       (push #'ogt-export-remove-segmenters org-export-filter-body-functions)
       (overlay-put ogt-source-segment-overlay
                   'face 'highlight)

reply via email to

[Prev in Thread] Current Thread [Next in Thread]