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

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

[elpa] externals/hyperbole f4d6c729a1 001/143: Hyrolo fixes; EXAMPLE.kot


From: ELPA Syncer
Subject: [elpa] externals/hyperbole f4d6c729a1 001/143: Hyrolo fixes; EXAMPLE.kotl save {C-u C-h h k e} default to home dir
Date: Mon, 19 Feb 2024 15:58:42 -0500 (EST)

branch: externals/hyperbole
commit f4d6c729a13111e3d9ee08da4dfc3f5376d57eac
Author: bw <rsw@gnu.org>
Commit: bw <rsw@gnu.org>

    Hyrolo fixes; EXAMPLE.kotl save {C-u C-h h k e} default to home dir
---
 .hypb                | Bin 2599 -> 2715 bytes
 ChangeLog            |  38 ++++++++++++++++++++++++----
 HY-TALK/HYPB         |  19 +++++++++++---
 hpath.el             |   6 ++---
 htz.el               |   5 ++--
 hyrolo.el            |  70 +++++++++++++++++++++++++++++++++++++--------------
 kotl/kotl-mode.el    |   4 +--
 test/hyrolo-tests.el |   1 +
 8 files changed, 107 insertions(+), 36 deletions(-)

diff --git a/.hypb b/.hypb
index 1d7d2c5982..c4530b271a 100644
Binary files a/.hypb and b/.hypb differ
diff --git a/ChangeLog b/ChangeLog
index ecd08c4d8b..731d93ed06 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,37 @@
+2023-12-03  Bob Weiner  <rsw@gnu.org>
+
+* test/hyrolo-tests.el (hyrolo-sort-test): Temporarily set to known
+    :failing, as is a known bug.
+
+2023-12-02  Bob Weiner  <rsw@gnu.org>
+
+* hyrolo.el (hyrolo-expand-path-list): Eliminate any non-existing
+    entries after expansion.
+            (hyrolo-date-format): Allow empty string to disable
+    date adding/updating in entries.
+            (hyrolo-set-date): Add optional 'edit-only-flag'
+    when non-nil, replaces existing dates but does not add new ones;
+    use as part of an edit command.  Do nothing if 'hyrolo-date-format'
+    is an empty string.  These changes support the new file formats
+    that HyRolo supports where you don't want a date added when jumping
+    to and editing entries.
+            (hyrolo-edit-date): Add for use with 'hyrolo-edit-hook'.
+           (hyrolo-edit-hook): Set to 'hyrolo-edit-date'.
+           (hyrolo-toggle-datestamps): Use 'hyrolo-edit-date'.
+           (hyrolo-to): Handle entries of all file types now supported
+    by HyRolo.  If kotl-mode, move to first valid position on the line.
+
+* kotl/kotl-mode.el (kotl-mode:example): Fix to prompt to save in
+    home directory, not the current directory.
+
 2023-12-01  Bob Weiner  <rsw@gnu.org>
 
+* hyrolo.el (hyrolo-add): Fix that narrow-to-region was narrowing to a
+    zero-sized region when point was not on an entry start character.
+    Also fix that when moved to point-max trying optimized insertion
+    but failing, never moved point back to point-min, so insertion
+    would occur at the buffer end rather than the proper point.
+
 * hargs.el (hargs:delimited): Remove use of 'bounds-of-thing-at-point'
     and (require 'thingatpt) since it doesn't use the delimiters given
     and returns wrong results.  This fixes defal tests that were failing.
@@ -84,10 +116,6 @@
     which exits and selects the first minibuffer line, not the candidate
     presently selected.
 
-* hargs.el (hargs:delimited):
-           (require 'thingatpt): For 'bounds-of-thing-at-point'
-    used in 'hargs:delimited' on single char matching delims.
-
 * hui-select.el (hui-select-scan-sexps): Add to fix brace handling
     as a matching pair when selecting things by using previously
     unused 'hui-select-syntax-table'.
@@ -742,7 +770,7 @@
 
 * kotl/kotl-mode.el (kotl-mode:self-insert-command): Remove special kotl-mode 
auto-filling
     is handled by regular 'self-insert-command'.  This fixes improper hanging 
indent auto-
-    filling in kcells due to narrowing kcell to text contens only, hiding the 
cell prefix.
+    filling in kcells due to narrowing kcell to text contents only, hiding the 
cell prefix.
                     (kotl-mode:pre-self-insert-command):
   kotl/kotl-orgtbl.el (kotl-mode:setup-overriding-orgtbl-keymap): Remove 
reference to
     'kotl-mode:self-insert-command'.
diff --git a/HY-TALK/HYPB b/HY-TALK/HYPB
index 4e3b14bb1f..f171c4f92d 100644
--- a/HY-TALK/HYPB
+++ b/HY-TALK/HYPB
@@ -9,6 +9,8 @@
         ;; org-present-startup-folded nil
        org-hide-emphasis-markers nil)
 
+  (setq org-present-text-scale 3)
+
   ;; Show only top-level headlines
   (org-overview)
 
@@ -20,6 +22,15 @@
 
 (add-hook 'org-present-after-navigate-functions 'rsw-org-present-setup)
 
+(add-hook 'org-present-mode-hook
+          (lambda ()
+            (org-present-big)
+            (org-display-inline-images)))
+
+(add-hook 'org-present-mode-quit-hook
+          (lambda ()
+            (org-present-small)
+            (org-remove-inline-images)))
 
 * Enable all Hyperbole keys including {M-RET} in Org mode
 
@@ -47,7 +58,7 @@ or interactively after loading Hyperbole:
   Deactivate: <interaction-log-mode 0>
 
 ** ALTERNATIVE: Keypression - overlaying parts of buffer (shows trail of keys)
-   Used for EmacsNYC talk
+  Used for EmacsNYC talk
 
   Install:    <unless (package-installed-p 'keypression) (package-install 
'keypression)>
   Activate:   <keypression-mode 1>
@@ -71,9 +82,9 @@ or interactively after loading Hyperbole:
 
     "!${PATH}/date"                  - execute 'date' shell command
 
-    "&Preview.app ${hyperb:dir}/man/hyperbole.pdf"
+    "&open ${hyperb:dir}/man/hyperbole.pdf"
 
-    "-subr.elc"                      - load an Elisp library
+    "-subr"                      - load an Elisp library
 
 * Programming Buttons
 
@@ -93,7 +104,7 @@ Emacs Yank Bug: bug#5320
 
 "${hyperb:dir}/DEMO"
 
-"${hyperb:dir}/README.md#Programmer Quick Reference"
+"${hyperb:dir}/README.md#Programmer Quick Reference:4:2"
 "${hyperb:dir}/README.md#programmer-quick-reference:4:2"
 
 <hpath:find "${hyperb:dir}">
diff --git a/hpath.el b/hpath.el
index b65538f481..e88014bc2b 100644
--- a/hpath.el
+++ b/hpath.el
@@ -3,7 +3,7 @@
 ;; Author:       Bob Weiner
 ;;
 ;; Orig-Date:     1-Nov-91 at 00:44:23
-;; Last-Mod:      1-Dec-23 at 01:11:32 by Bob Weiner
+;; Last-Mod:      2-Dec-23 at 19:05:05 by Bob Weiner
 ;;
 ;; SPDX-License-Identifier: GPL-3.0-or-later
 ;;
@@ -1259,13 +1259,13 @@ files with names matching optional MATCH-REGEXP 
(otherwise, all
 files), filters out non-strings and non-existent filenames when
 optional EXISTS-FLAG is non-nil, expands file wildcards when
 `find-file-wildcards' is non-nil (the default), substitutes for
-multipled $VAR environment variables, substitutes up to one
+multiple $var environment variables, and substitutes up to one
 ${variable} per path."
   (mapcan (lambda (path)
            (setq path (hpath:expand path exists-flag))
            (when (setq path (or (when find-file-wildcards
                                   (file-expand-wildcards path))
-                                (list path)))
+                                (unless exists-flag (list path))))
              (if (= (length path) 1)
                  (setq path (car path))
                (setq paths (nconc (cdr path) paths)
diff --git a/htz.el b/htz.el
index 010caf7fd0..2c72b47cf5 100644
--- a/htz.el
+++ b/htz.el
@@ -3,7 +3,7 @@
 ;; Author:       Masanobu Umeda             / Bob Weiner
 ;;
 ;; Orig-Date:    14-Oct-91 at 07:22:08
-;; Last-Mod:      3-Oct-23 at 23:26:02 by Mats Lidell
+;; Last-Mod:      2-Dec-23 at 23:27:40 by Bob Weiner
 ;;
 ;; SPDX-License-Identifier: GPL-3.0-or-later
 ;;
@@ -132,8 +132,7 @@ prepended.  Timezone in DATE is optional, it defaults to the
 value of `htz:local'.
 
 Recognizes the following styles:
- (1) \"(1 30 1999)\" or \"(1 30 1999)\"  `calendar-julian-date'
-     requires PARSED-CURRENT-DATE arg
+ (1) \"(1 30 1999)\" `calendar-julian-date' requires PARSED-CURRENT-DATE arg
  (2) \"14 Apr 89 03:20[:12] [GMT]\"
  (3) \"Fri, 17 Mar [19]89 4:01[:33] [GMT]\"
  (4) \"Mon Jan 16 16:12[:37] [GMT] 1989\"
diff --git a/hyrolo.el b/hyrolo.el
index 4f795f4487..86ec53f7e3 100644
--- a/hyrolo.el
+++ b/hyrolo.el
@@ -3,7 +3,7 @@
 ;; Author:       Bob Weiner
 ;;
 ;; Orig-Date:     7-Jun-89 at 22:08:29
-;; Last-Mod:      1-Dec-23 at 02:24:49 by Bob Weiner
+;; Last-Mod:      2-Dec-23 at 22:00:29 by Bob Weiner
 ;;
 ;; SPDX-License-Identifier: GPL-3.0-or-later
 ;;
@@ -75,6 +75,7 @@
 (declare-function helm-org-rifle-files "ext:helm-org-rifle")
 (declare-function helm-org-rifle-org-directory "ext:helm-org-rifle")
 (declare-function helm-org-rifle-show-full-contents "ext:helm-org-rifle")
+(declare-function kotl-mode:to-valid-position "kotl/kotl-mode")
 (declare-function org-roam-db-autosync-mode "ext:org-roam")
 (declare-function xml-node-child-string "ext:google-contacts")
 (declare-function xml-node-get-attribute-type "ext:google-contacts")
@@ -172,6 +173,8 @@ level.")
 
 (defcustom hyrolo-date-format "%m/%d/%Y"
   "Format of date string used in Rolo automatic date stamps.
+An empty string disables adding or updating HyRolo dates.
+
 Default is American style.  See documentation of the function
 `format-time-string' for format options."
   :type 'string
@@ -246,7 +249,7 @@ Only unmodified buffers are killed."
 
 ;; Insert or update the entry date each time an entry is added or edited.
 (add-hook 'hyrolo-add-hook  #'hyrolo-set-date)
-(add-hook 'hyrolo-edit-hook #'hyrolo-set-date)
+(add-hook 'hyrolo-edit-hook #'hyrolo-edit-date)
 
 (defvar hyrolo-yank-reformat-function #'ignore
   "*A function of two arguments, START and END, invoked after a `hyrolo-yank'.
@@ -276,7 +279,7 @@ they contain that match `hyrolo-file-suffix-regexp'.  Then, 
if
 containing [char-matches] or * wildcards are expanded to their
 matches."
   (if paths
-      (hpath:expand-list paths hyrolo-file-suffix-regexp)
+      (hpath:expand-list paths hyrolo-file-suffix-regexp t)
     (delq nil
          (list "~/.rolo.otl"
                (if (and (boundp 'bbdb-file) (stringp bbdb-file)) bbdb-file)
@@ -419,7 +422,8 @@ entry which begins with the parent string."
          (setq level (match-string-no-properties hyrolo-entry-group-number))
        (error "(hyrolo-add): Insertion failed, `%s' parent entry not found in 
\"%s\""
               parent file)))
-    (narrow-to-region (point) (progn (hyrolo-to-entry-end t) (point)))
+    (when (looking-at hyrolo-entry-regexp)
+      (narrow-to-region (point) (progn (hyrolo-to-entry-end t) (point))))
     (let* ((name-level (concat level "*"))
           (level-len (length name-level))
           (first-char (aref name 0))
@@ -458,6 +462,8 @@ entry which begins with the parent string."
                (setq again nil))))
        (goto-char (point-min)))
 
+      (when again
+       (goto-char (point-min)))
       (while (and again (re-search-forward entry-regexp nil 'end))
        (setq entry-level-len (length (match-string-no-properties 
hyrolo-entry-group-number)))
        (if (/= entry-level-len level-len)
@@ -1102,11 +1108,11 @@ With optional ARG, turn them on iff ARG is positive."
               (boundp 'hyrolo-add-hook) (listp hyrolo-add-hook)
               (memq 'hyrolo-set-date hyrolo-add-hook)))
       (progn (remove-hook 'hyrolo-add-hook #'hyrolo-set-date)
-            (remove-hook 'hyrolo-edit-hook #'hyrolo-set-date)
+            (remove-hook 'hyrolo-edit-hook #'hyrolo-edit-date)
             (message "Rolo date stamps are now off."))
     (add-hook 'hyrolo-add-hook  #'hyrolo-set-date)
-    (add-hook 'hyrolo-edit-hook #'hyrolo-set-date)
-    (message "Rolo date stamps are now on.")))
+    (add-hook 'hyrolo-edit-hook #'hyrolo-edit-date)
+    (message "HyRolo date stamps are now on.")))
 
 (defun hyrolo-toggle-narrow-to-entry ()
   "Toggle between display of current entry and display of all matched entries.
@@ -1887,12 +1893,22 @@ nil if not found."
                                (save-excursion
                                  (hyrolo-to-entry-end t) (point)))))
          (goto-char (point-min))
-         (while (and (search-forward name nil t)
-                     (not (save-excursion
-                            (forward-line 0)
-                            (setq found
-                                  (when (looking-at (concat 
hyrolo-entry-regexp (regexp-quote name)))
-                                    (point)))))))))
+         (while (and
+                 ;; Search for just the leaf part of a name
+                 (search-forward name nil t)
+                 (not (save-excursion
+                        (forward-line 0)
+                        (setq found
+                              (when (or (looking-at (buffer-local-value
+                                                     'outline-regexp
+                                                     (get-buffer 
hyrolo-display-buffer)))
+                                        ;; Jump to non-first line
+                                        ;; within an entry
+                                        (progn (back-to-indentation)
+                                               (looking-at (regexp-quote 
name))))
+                                (when (derived-mode-p 'kotl-mode)
+                                  (kotl-mode:to-valid-position))
+                                (point)))))))))
       (unless found
        (hyrolo-kill-buffer))) ;; conditionally kill
     (hyrolo-widen)
@@ -1977,10 +1993,18 @@ HYROLO-BUF may be a file-name, `buffer-name', or 
buffer."
   "Go to end of current entry, ignoring sub-entries."
   (let (case-fold-search)
     (if (re-search-forward (concat hyrolo-hdr-regexp "\\|"
-                                  hyrolo-entry-regexp) nil t)
+                                  hyrolo-entry-regexp)
+                          nil t)
        (progn (beginning-of-line) (point))
       (goto-char (point-max)))))
 
+(defun hyrolo-edit-date ()
+  "Replace an existing date at the end of the current hyrolo entry.
+Suitable for use as an entry in `hyrolo-edit-hook'.
+
+The date format is determined by the setting, `hyrolo-date-format', with
+a default of MM/DD/YYYY."
+  (hyrolo-set-date t))
 
 (defun hyrolo-format-name (name-str first last)
   "Reverse order of NAME-STR field given my regexp match field FIRST and LAST."
@@ -2100,24 +2124,32 @@ Default is current buffer.  Used, for example, after a 
rolo entry is killed."
   (and hyrolo-save-buffers-after-use (buffer-modified-p hyrolo-buf)
        (set-buffer hyrolo-buf) (save-buffer)))
 
-(defun hyrolo-set-date ()
+(defun hyrolo-set-date (&optional edit-only-flag)
   "Add a line with the current date at the end of the current hyrolo entry.
-Does not add a date if in a Koutline buffer.
+With optional non-nil EDIT-ONLY-FLAG, edit an existing date but do
+not add one if the entry lacks one.
+
+Do nothing if in a Koutline buffer or if `hyrolo-date-format' is an
+empty string.
 
 Suitable for use as an entry in `hyrolo-add-hook' and `hyrolo-edit-hook'.
 The date format is determined by the setting, `hyrolo-date-format', with
 a default of MM/DD/YYYY."
-  (unless (derived-mode-p 'kotl-mode)
+  (unless (or (string-empty-p hyrolo-date-format) (null hyrolo-date-format)
+             (derived-mode-p 'kotl-mode))
     (save-excursion
       (skip-chars-forward "*")
       (hyrolo-to-entry-end)
       (skip-chars-backward " \t\n\r\f")
       (skip-chars-backward "^\n\r\f")
       (if (looking-at "\\s-+[-0-9./]+\\s-*$") ;; a date
+         ;; edit date
          (progn (delete-region (point) (match-end 0))
                 (insert "\t" (hyrolo-current-date)))
-       (end-of-line)
-       (insert "\n\t" (hyrolo-current-date))))))
+       (unless edit-only-flag
+         ;; add date
+         (end-of-line)
+         (insert "\n\t" (hyrolo-current-date)))))))
 
 (defun hyrolo-min-matched-level ()
   "Return the minimum hyrolo level within a single file of matches."
diff --git a/kotl/kotl-mode.el b/kotl/kotl-mode.el
index 3b218aa844..2fd9af07d9 100644
--- a/kotl/kotl-mode.el
+++ b/kotl/kotl-mode.el
@@ -3,7 +3,7 @@
 ;; Author:       Bob Weiner
 ;;
 ;; Orig-Date:    6/30/93
-;; Last-Mod:     19-Nov-23 at 13:18:47 by Bob Weiner
+;; Last-Mod:      2-Dec-23 at 17:28:41 by Bob Weiner
 ;;
 ;; SPDX-License-Identifier: GPL-3.0-or-later
 ;;
@@ -234,7 +234,7 @@ Hyperbole EXAMPLE."
   (interactive
    (list (when current-prefix-arg
           (read-file-name "Path to replace and save EXAMPLE.kotl file: "
-                          nil nil nil "EXAMPLE.kotl"))))
+                          "~/" nil nil "EXAMPLE.kotl"))))
   (when (and current-prefix-arg (called-interactively-p 'interactive))
     (setq replace-flag t))
   (let (personal-example
diff --git a/test/hyrolo-tests.el b/test/hyrolo-tests.el
index 53a9fe47fb..60946266a8 100644
--- a/test/hyrolo-tests.el
+++ b/test/hyrolo-tests.el
@@ -204,6 +204,7 @@ and {b} the previous same level cell."
 
 (ert-deftest hyrolo-sort-test ()
   "HyRolo files can be sorted."
+  :expected-result :failed
   (let ((hyrolo-file (make-temp-file "hypb" nil ".otl")))
     (unwind-protect
         (let ((hyrolo-file-list (list hyrolo-file)))



reply via email to

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