emacs-elpa-diffs
[Top][All Lists]
Advanced

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

[elpa] master 1143b69 6/6: Merge commit 'c3683a0a8a611fbd15bb3ec78ccac12


From: Ian Dunn
Subject: [elpa] master 1143b69 6/6: Merge commit 'c3683a0a8a611fbd15bb3ec78ccac121843711c9'
Date: Mon, 19 Feb 2018 14:20:20 -0500 (EST)

branch: master
commit 1143b69b08f2939e695db3423c06fd70f13f304f
Merge: e65aa3f c3683a0
Author: Ian Dunn <address@hidden>
Commit: Ian Dunn <address@hidden>

    Merge commit 'c3683a0a8a611fbd15bb3ec78ccac121843711c9'
---
 packages/paced/paced-tests.el        |  11 ++++
 packages/paced/paced.el              |  24 ++++++--
 packages/paced/paced.info            | 105 +++++++++++++++++++++++------------
 packages/paced/paced.org             |  24 ++++++++
 packages/paced/test-files/fourth.org |   2 +
 5 files changed, 124 insertions(+), 42 deletions(-)

diff --git a/packages/paced/paced-tests.el b/packages/paced/paced-tests.el
index c7dc3bb..3f8d0ea 100644
--- a/packages/paced/paced-tests.el
+++ b/packages/paced/paced-tests.el
@@ -41,6 +41,7 @@
 (defconst paced-first-test-file  (paced-test-file "first.txt"))
 (defconst paced-second-test-file (paced-test-file "second.cpp"))
 (defconst paced-third-test-file  (paced-test-file "third.org"))
+(defconst paced-fourth-test-file  (paced-test-file "fourth.org"))
 
 (defconst paced-test-dict-save-file (paced-test-file 
"paced-dictionary-case-sensitive"))
 (defconst paced-test-default-registered-map (make-hash-table :test 'equal))
@@ -491,6 +492,16 @@
       (let* ((paced-character-limit 3))
         (should-not (paced-excluded-p))))))
 
+(ert-deftest paced-no-thing-at-point ()
+  "Test for non-existent thing at point."
+  (let* ((org-element-use-cache nil) ;; Causes crashes, so disable it
+         (paced-exclude-function (lambda () nil))
+         (buffer-four (find-file-noselect paced-fourth-test-file)))
+    (with-current-buffer buffer-four
+      (goto-char (point-min))
+      (should-not (paced-thing-at-point))
+      (should (paced-excluded-p)))))
+
 (provide 'paced-tests)
 
 ;;; paced-tests.el ends here
diff --git a/packages/paced/paced.el b/packages/paced/paced.el
index 73d9488..6b8f2aa 100644
--- a/packages/paced/paced.el
+++ b/packages/paced/paced.el
@@ -7,7 +7,7 @@
 ;; Keywords: convenience, completion
 ;; Package-Requires: ((emacs "25.1") (async "1.9.1"))
 ;; URL: https://savannah.nongnu.org/projects/paced-el/
-;; Version: 1.1.2
+;; Version: 1.1.3
 ;; Created: 22 Jan 2017
 ;; Modified: 05 Feb 2018
 
@@ -331,6 +331,10 @@ customization interface."
   "Return the name of dictionary OBJ."
   (oref obj object-name))
 
+(cl-defmethod paced-dictionary-empty-p ((dict paced-dictionary))
+  "Return non-nil if DICT is empty."
+  (map-empty-p (oref dict usage-hash)))
+
 ;;; Current Dictionary
 
 (defcustom paced-global-dictionary-enable-alist nil
@@ -601,9 +605,13 @@ the thing at point.  See
 `paced-point-in-thing-at-point-for-exclusion' for how to set
 this.
 
+If there is no current \"thing\" at point, the text under point
+will be excluded, and paced will move on.
+
 This also handles character limits set by
 `paced-character-limit'."
   (or (not (paced-thing-meets-limit-p))
+      (not (paced-bounds-of-thing-at-point)) ;; There's no thing at point
       (save-excursion
         (pcase paced-point-in-thing-at-point-for-exclusion
           (`beginning
@@ -1271,11 +1279,15 @@ For how the current dictionary is determined, see
 
 (cl-defmethod paced-dictionary-length-of-longest-word ((dict paced-dictionary))
   "Return the length of the longest word in DICT."
-  (seq-max
-   (map-apply
-    (lambda (key _value)
-      (length key))
-    (oref dict usage-hash))))
+  (cond
+   ;; If DICT is empty, seq-max throws an error.
+   ((paced-dictionary-empty-p dict) 0)
+   (t
+    (seq-max
+     (map-apply
+      (lambda (key _value)
+        (length key))
+      (oref dict usage-hash))))))
 
 (cl-defmethod paced-dictionary-tabulated-list-entries ((dict paced-dictionary))
   "Create a value for `tabulated-list-entries' from DICT."
diff --git a/packages/paced/paced.info b/packages/paced/paced.info
index c06565a..a39ac19 100644
--- a/packages/paced/paced.info
+++ b/packages/paced/paced.info
@@ -67,6 +67,7 @@ Contributing
 
 Changelog
 
+* 1.1.3: 113.
 * 1.1.2: 112.
 * 1.1.1: 111.
 * 1.1: 11.
@@ -617,6 +618,21 @@ This can be added to ‘paced-async.el’:
            (when (match-string 1)
              (<= (match-beginning 1) p (match-end 1))))))
 
+     (defun org-at-keyword-p ()
+       "Return non-nil if point is at a keyword such as #+TITLE."
+       (save-excursion
+         (beginning-of-line)
+         (looking-at-p "^#\\+")))
+
+     (defun org-at-heading-prefix-p ()
+       "Return non-nil if looking at the leading stars of a heading."
+       (looking-at outline-regexp))
+
+     (defun org-at-hline-p ()
+       (save-excursion
+         (beginning-of-line)
+         (looking-at-p "^-----")))
+
      (defun org-paced-exclude ()
        (or
         ;; Drawers
@@ -624,6 +640,12 @@ This can be added to ‘paced-async.el’:
         (org-in-regexp ":END:") ;; but this does
 
         (org-at-tag-p) ;; tags
+        (org-at-keyword-p) ;; Keywords, such as #+TITLE
+        (org-at-heading-prefix-p) ;; Leading stars of a heading
+        (org-at-item-bullet-p) ;; Item Bullets
+        (org-at-timestamp-p) ;; Timestamps
+        (looking-at-p org-todo-regexp) ;; TODO keywords
+        (org-at-hline-p) ;; H-lines
 
         (org-at-comment-p) ;; comments
         (org-in-regexp org-any-link-re) ;; links
@@ -885,6 +907,7 @@ Changelog
 
 * Menu:
 
+* 1.1.3: 113.
 * 1.1.2: 112.
 * 1.1.1: 111.
 * 1.1: 11.
@@ -892,7 +915,16 @@ Changelog
 * 1.0: 10.
 
 
-File: paced.info,  Node: 112,  Next: 111,  Up: Changelog
+File: paced.info,  Node: 113,  Next: 112,  Up: Changelog
+
+1.1.3
+=====
+
+   • Fixed bug with printing an empty dictionary
+   • Fixed bug with paced crashing on non-existent thing at point
+
+
+File: paced.info,  Node: 112,  Next: 111,  Prev: 113,  Up: Changelog
 
 1.1.2
 =====
@@ -952,41 +984,42 @@ Initial release.
 
 Tag Table:
 Node: Top228
-Node: Copying1999
-Node: Introduction2818
-Node: Similar Packages3938
-Node: pabbrev4224
-Node: predictive5367
-Node: Installation6415
-Node: Basic Setup7077
-Node: Dictionaries7692
-Node: Creating a Dictionary8165
-Node: Editing a Dictionary9205
-Node: Selective Dictionaries9681
-Node: Dictionary Files11419
-Node: Printing a Dictionary12540
-Node: Population Commands13062
-Node: Built-in Commands13998
-Node: Properties14795
-Node: Custom Commands15793
-Node: Asynchronous Population18520
-Node: Example Setups19969
-Node: Org Agenda Files20270
-Node: Project Files22030
-Node: Markdown Files23166
-Node: Repopulating Dictionary After Saving24791
-Node: Repopulating Dictionary After Spellchecking the Buffer25719
-Node: Contributing26464
-Node: Bugs27238
-Node: Development27627
-Node: Documentation29388
-Node: Working with EDE29855
-Node: Changelog30898
-Node: 11231062
-Node: 11131180
-Node: 1131419
-Node: 10132026
-Node: 1032234
+Node: Copying2013
+Node: Introduction2832
+Node: Similar Packages3952
+Node: pabbrev4238
+Node: predictive5381
+Node: Installation6429
+Node: Basic Setup7091
+Node: Dictionaries7706
+Node: Creating a Dictionary8179
+Node: Editing a Dictionary9219
+Node: Selective Dictionaries9695
+Node: Dictionary Files11433
+Node: Printing a Dictionary12554
+Node: Population Commands13076
+Node: Built-in Commands14012
+Node: Properties14809
+Node: Custom Commands15807
+Node: Asynchronous Population18534
+Node: Example Setups19983
+Node: Org Agenda Files20284
+Node: Project Files22795
+Node: Markdown Files23931
+Node: Repopulating Dictionary After Saving25556
+Node: Repopulating Dictionary After Spellchecking the Buffer26484
+Node: Contributing27229
+Node: Bugs28003
+Node: Development28392
+Node: Documentation30153
+Node: Working with EDE30620
+Node: Changelog31663
+Node: 11331841
+Node: 11232034
+Node: 11132164
+Node: 1132403
+Node: 10133010
+Node: 1033218
 
 End Tag Table
 
diff --git a/packages/paced/paced.org b/packages/paced/paced.org
index fae0379..495f3cb 100644
--- a/packages/paced/paced.org
+++ b/packages/paced/paced.org
@@ -477,6 +477,21 @@ added to ~paced-async.el~:
       (when (match-string 1)
         (<= (match-beginning 1) p (match-end 1))))))
 
+(defun org-at-keyword-p ()
+  "Return non-nil if point is at a keyword such as #+TITLE."
+  (save-excursion
+    (beginning-of-line)
+    (looking-at-p "^#\\+")))
+
+(defun org-at-heading-prefix-p ()
+  "Return non-nil if looking at the leading stars of a heading."
+  (looking-at outline-regexp))
+
+(defun org-at-hline-p ()
+  (save-excursion
+    (beginning-of-line)
+    (looking-at-p "^-----")))
+
 (defun org-paced-exclude ()
   (or
    ;; Drawers
@@ -484,6 +499,12 @@ added to ~paced-async.el~:
    (org-in-regexp ":END:") ;; but this does
 
    (org-at-tag-p) ;; tags
+   (org-at-keyword-p) ;; Keywords, such as #+TITLE
+   (org-at-heading-prefix-p) ;; Leading stars of a heading
+   (org-at-item-bullet-p) ;; Item Bullets
+   (org-at-timestamp-p) ;; Timestamps
+   (looking-at-p org-todo-regexp) ;; TODO keywords
+   (org-at-hline-p) ;; H-lines
 
    (org-at-comment-p) ;; comments
    (org-in-regexp org-any-link-re) ;; links
@@ -734,6 +755,9 @@ and letting one of us handle it is a good way to go.
 :PROPERTIES:
 :DESCRIPTION: List of changes by version
 :END:
+** 1.1.3
+- Fixed bug with printing an empty dictionary
+- Fixed bug with paced crashing on non-existent thing at point
 ** 1.1.2
 - Fixed bug with printing dictionaries
 ** 1.1.1
diff --git a/packages/paced/test-files/fourth.org 
b/packages/paced/test-files/fourth.org
new file mode 100644
index 0000000..2d7b9ad
--- /dev/null
+++ b/packages/paced/test-files/fourth.org
@@ -0,0 +1,2 @@
+#+CATEGORY: Testing
+Test1 Test2



reply via email to

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