[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/hyperbole 147852f5de 1/7: hactypes.el (link-to-texinfo-
From: |
ELPA Syncer |
Subject: |
[elpa] externals/hyperbole 147852f5de 1/7: hactypes.el (link-to-texinfo-node): Sub for var name in filename |
Date: |
Mon, 27 Dec 2021 04:57:36 -0500 (EST) |
branch: externals/hyperbole
commit 147852f5dead95e0c5e46708252fbdba2a56fb05
Author: Bob Weiner <rsw@gnu.org>
Commit: Bob Weiner <rsw@gnu.org>
hactypes.el (link-to-texinfo-node): Sub for var name in filename
hui.el (hui:link-possible-types): Require 'texnfo-upd when needed to ensure
texinfo-copy-node-name is defined before used since it is not autoloaded.
kotl/kotl-mode.el (kotl-mode:insert-region, kotl-mode:insert-tree): Add
these new commands
so can insert Koutline parts directly into other buffers without having
to copy from
the mail buffer via 'kotl-mode:mail-tree'.
hargs.el (hargs:at-p): Fix so when reading a buffer arg, if tag at point
does not match
an existing buffer name, then use the buffer name at point.
(hargs:read-buffer-name): Add for use by kotl-mode.
---
ChangeLog | 13 ++++++++
hactypes.el | 2 +-
hargs.el | 10 +++++-
hmail.el | 28 +++++++++-------
hui-window.el | 2 +-
hui.el | 1 +
kotl/kotl-mode.el | 99 ++++++++++++++++++++++++++++++++++++++++++-------------
7 files changed, 118 insertions(+), 37 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index ce7469b1c4..8d0bf9bf69 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,18 @@
2021-12-12 Bob Weiner <rsw@gnu.org>
+* hactypes.el (link-to-texinfo-node): Substitute for variable names in file
linked to.
+
+* hui.el (hui:link-possible-types): Require 'texnfo-upd when needed to ensure
+ texinfo-copy-node-name is defined before used since it is not autoloaded.
+
+* kotl/kotl-mode.el (kotl-mode:insert-region, kotl-mode:insert-tree): Add
these new commands
+ so can insert Koutline parts directly into other buffers without having to
copy from
+ the mail buffer via 'kotl-mode:mail-tree'.
+
+* hargs.el (hargs:at-p): Fix so when reading a buffer arg, if tag at point
does not match
+ an existing buffer name, then use the buffer name at point.
+ (hargs:read-buffer-name): Add for use by kotl-mode.
+
* hyperbole.el (hkey-initialize): Add missing C-c prefix binding for
hyperbole-mode-map.
2021-12-11 Mats Lidell <matsl@gnu.org>
diff --git a/hactypes.el b/hactypes.el
index 33fe8cc57c..99eec0a5e6 100644
--- a/hactypes.el
+++ b/hactypes.el
@@ -615,7 +615,7 @@ FILE may be a string or nil, in which case the current
buffer is used."
(interactive "fTexinfo file to link to: \nsNode within file to link to: ")
(let (node-point)
(if file
- (set-buffer (find-file-noselect file))
+ (set-buffer (find-find-noselect (hpath:substitute-value file)))
(setq file buffer-file-name))
(save-excursion
(goto-char (point-min))
diff --git a/hargs.el b/hargs.el
index 3080eb3c86..d619b5766d 100644
--- a/hargs.el
+++ b/hargs.el
@@ -397,7 +397,10 @@ Handles all of the interactive argument types that
`hargs:iform-read' does."
(let ((sym (hargs:find-tag-default)))
(when (or (fboundp sym) (boundp sym)) sym)))
((eq hargs:reading-p 'buffer)
- (hargs:find-tag-default))
+ (let ((tag (hargs:find-tag-default)))
+ (if (member tag (mapcar #'buffer-name (buffer-list)))
+ tag
+ (buffer-name))))
((eq hargs:reading-p 'character)
(following-char))
((eq hargs:reading-p 'key)
@@ -595,6 +598,11 @@ string read or nil."
(select-window owind)
(switch-to-buffer obuf))))
+(defun hargs:read-buffer-name (prompt)
+ "Use PROMPT to read an existing buffer name and return it."
+ (hargs:read-match prompt (mapcar #'buffer-name (buffer-list)) nil t nil
'buffer))
+
+
(defun hargs:read-match (prompt collection
&optional predicate must-match initial-input val-type)
"PROMPT with completion for a value in COLLECTION and return it.
diff --git a/hmail.el b/hmail.el
index 94027e38ec..8c13e16be9 100644
--- a/hmail.el
+++ b/hmail.el
@@ -117,8 +117,8 @@ Optional SUBJECT and HELP message may also be given."
(setq subject "Be explicit here. Make a statement or ask a question."))
(hmail:invoke address nil subject)
(eval expr)
- (if (re-search-backward "^Subject: " nil t)
- (goto-char (match-end 0)))
+ (when (re-search-backward "^Subject: " nil t)
+ (goto-char (match-end 0)))
(message (if (stringp help)
help
"Replace subject, compose message, and then mail.")))
@@ -157,9 +157,12 @@ Optional SUBJECT and HELP message may also be given."
Optional arguments are ADDRESS, CC list and SUBJECT of mail."
;; Next 3 lines prevent blank lines between fields due to
;; fill-region-as-paragraph within mail-setup.
- (if (equal address "") (setq address nil))
- (if (equal cc "") (setq cc nil))
- (if (equal subject "") (setq subject nil))
+ (when (equal address "")
+ (setq address nil))
+ (when (equal cc "")
+ (setq cc nil))
+ (when (equal subject "")
+ (setq subject nil))
(compose-mail address subject (if cc (list (cons "CC" cc)))))
@@ -182,7 +185,8 @@ Optional arguments are ADDRESS, CC list and SUBJECT of
mail."
"Narrows buffer to displayable part of current message.
Its displayable part begins at optional MSG-START and ends at or before
MSG-END."
- (if (hmail:reader-p) (rmail:msg-widen))
+ (when (hmail:reader-p)
+ (rmail:msg-widen))
(setq msg-start (or msg-start (point-min))
msg-end (or msg-end (point-max)))
(narrow-to-region msg-start (hmail:hbdata-start msg-start msg-end)))
@@ -198,15 +202,17 @@ non-nil. Optional BUF contains the region and defaults
to the current
buffer. It may be a buffer or buffer name."
(interactive (list (region-beginning) (region-end) (current-buffer)
(y-or-n-p "Include invisible text? ")))
- (or buf (setq buf (current-buffer)))
- (if (stringp buf) (setq buf (get-buffer buf)))
+ (unless buf
+ (setq buf (current-buffer)))
+ (when (stringp buf)
+ (setq buf (get-buffer buf)))
(let (mail-buf)
(hmail:invoke)
(setq mail-buf (current-buffer))
(save-excursion
- (if (search-forward mail-header-separator nil t)
- ;; Within header, so move to body
- (goto-char (point-max)))
+ (when (search-forward mail-header-separator nil t)
+ ;; Within header, so move to body
+ (goto-char (point-max)))
(set-buffer buf)
(hypb:insert-region mail-buf start end invisible-flag))))
diff --git a/hui-window.el b/hui-window.el
index 9200b4b2ba..8d80455f6b 100644
--- a/hui-window.el
+++ b/hui-window.el
@@ -879,7 +879,7 @@ item, this moves the menu buffer itself to the release
location."
(if (not (window-live-p w1))
(error "(hmouse-item-to-window): Action Mouse Key item
drag must start in a live window")
(error "(hmouse-item-to-window): No item to display at start
of Action Mouse Key drag")))
- ((buffer-live-p w1-ref)
+ ((buffer-live-p w1-ref) ;; Must be a buffer, not a buffer name
(set-window-buffer w2 w1-ref)
(set-buffer w1-ref))
((and (stringp w1-ref) (file-readable-p w1-ref))
diff --git a/hui.el b/hui.el
index 44231de26d..850bc6a666 100644
--- a/hui.el
+++ b/hui.el
@@ -1271,6 +1271,7 @@ Buffer without File link-to-buffer-tmp"
(when (and (not (looking-at "@node "))
(not (re-search-backward "^@node " nil
t)))
(hypb:error "(hui:link-possible-types): Not
within a texinfo node"))
+ (require 'texnfo-upd)
(setq node (texinfo-copy-node-name)))
(list 'link-to-texinfo-node buffer-file-name node)))
((hmail:reader-p)
diff --git a/kotl/kotl-mode.el b/kotl/kotl-mode.el
index 43aca49763..812b756573 100644
--- a/kotl/kotl-mode.el
+++ b/kotl/kotl-mode.el
@@ -2396,29 +2396,6 @@ If ARG is a non-positive number, nothing is done."
(kview:add-cell "1" 1)))
(kotl-mode:to-valid-position))))
-(defun kotl-mode:mail-tree (cell-ref invisible-flag)
- "Mail outline tree rooted at CELL-REF. Use \"0\" for whole outline buffer.
-Invisible text is expanded and included in the mail only if INVISIBLE-FLAG is
-non-nil."
- (interactive
- (let ((label-default (kcell-view:label)))
- (hargs:iform-read
- `(interactive
- (list
- (hargs:read "Mail tree: (0 for whole outline) "
- nil ,label-default nil 'kcell)
- (y-or-n-p "Include invisible text? "))))))
- (if (equal cell-ref "0")
- (hmail:buffer nil invisible-flag)
- (let (start end)
- (save-excursion
- (kotl-mode:goto-cell cell-ref t)
- (forward-line 0)
- (setq start (point))
- (kotl-mode:to-valid-position)
- (setq end (kotl-mode:tree-end)))
- (hmail:region start end nil invisible-flag))))
-
(defun kotl-mode:promote-tree (arg)
"Move current tree a maximum of prefix ARG levels higher in current view.
Each cell is refilled iff its `no-fill' attribute is nil and
@@ -2613,6 +2590,82 @@ that contains mark."
(goto-char mark)
(set-marker mark nil))))))
+;;; ------------------------------------------------------------------------
+;;; Structure Insertion Across Buffers
+;;; ------------------------------------------------------------------------
+
+(defun kotl-mode:insert-region (target-buf start end &optional source-buf
invisible-flag)
+ "Insert into TARGET-BUF the region between START and END from the current
buffer or optional SOURCE-BUF (a buffer namre or buffer).
+Invisible text is expanded and included only if INVISIBLE-FLAG is non-nil."
+ (interactive
+ (hargs:iform-read
+ '(interactive
+ (let ((target-buf (hargs:read-buffer-name
+ (format "Insert into buffer (default %s): "
(other-buffer)))))
+ (when (buffer-local-value 'buffer-read-only (get-buffer target-buf))
+ (signal 'buffer-read-only (list target-buf)))
+ (list (region-beginning) (region-end) (current-buffer)
+ (y-or-n-p "Include invisible text? ")
+ target-buf)))))
+ (unless source-buf
+ (setq source-buf (current-buffer)))
+ (when (stringp source-buf)
+ (setq source-buf (get-buffer source-buf)))
+ (save-excursion
+ (set-buffer source-buf)
+ (hypb:insert-region target-buf start end invisible-flag)))
+
+(defun kotl-mode:insert-tree (target-buf cell-ref invisible-flag)
+ "Insert into TARGET-BUF the outline tree rooted at CELL-REF. Use \"0\" for
whole outline buffer.
+Invisible text is expanded and included in the mail only if INVISIBLE-FLAG is
+non-nil."
+ (interactive
+ (let ((label-default (kcell-view:label)))
+ (hargs:iform-read
+ `(interactive
+ (list
+ (prog1
+ (setq target-buf (hargs:read-buffer-name
+ (format "Insert tree into buffer (default %s): "
(other-buffer))))
+ (when (buffer-local-value 'buffer-read-only (get-buffer target-buf))
+ (signal 'buffer-read-only (list target-buf))))
+ (hargs:read "Insert tree number: (0 for whole outline) "
+ nil ,label-default nil 'kcell)
+ (y-or-n-p "Include invisible text? "))))))
+ (if (equal cell-ref "0")
+ (kotl-mode:insert-region target-buf (point-min) (point-max) nil
invisible-flag)
+ (let (start end)
+ (save-excursion
+ (kotl-mode:goto-cell cell-ref t)
+ (forward-line 0)
+ (setq start (point))
+ (kotl-mode:to-valid-position)
+ (setq end (kotl-mode:tree-end)))
+ (kotl-mode:insert-region target-buf start end nil invisible-flag))))
+
+(defun kotl-mode:mail-tree (cell-ref invisible-flag)
+ "Mail outline tree rooted at CELL-REF. Use \"0\" for whole outline buffer.
+Invisible text is expanded and included in the mail only if INVISIBLE-FLAG is
+non-nil."
+ (interactive
+ (let ((label-default (kcell-view:label)))
+ (hargs:iform-read
+ `(interactive
+ (list
+ (hargs:read "Mail tree: (0 for whole outline) "
+ nil ,label-default nil 'kcell)
+ (y-or-n-p "Include invisible text? "))))))
+ (if (equal cell-ref "0")
+ (hmail:buffer nil invisible-flag)
+ (let (start end)
+ (save-excursion
+ (kotl-mode:goto-cell cell-ref t)
+ (forward-line 0)
+ (setq start (point))
+ (kotl-mode:to-valid-position)
+ (setq end (kotl-mode:tree-end)))
+ (hmail:region start end nil invisible-flag))))
+
;;; ------------------------------------------------------------------------
;;; Structure Viewing
;;; ------------------------------------------------------------------------
- [elpa] externals/hyperbole updated (74431604b5 -> 4e1f1b03e9), ELPA Syncer, 2021/12/27
- [elpa] externals/hyperbole e741a93aa0 3/7: hyrolo.el (hyrolo-map-level): Fix {C-h h r o} order cmd / sorting., ELPA Syncer, 2021/12/27
- [elpa] externals/hyperbole 147852f5de 1/7: hactypes.el (link-to-texinfo-node): Sub for var name in filename,
ELPA Syncer <=
- [elpa] externals/hyperbole 40cbd4bbaf 2/7: Merge branch 'master' of hyperbole (hanging parens removal), ELPA Syncer, 2021/12/27
- [elpa] externals/hyperbole eaa2ac0b13 5/7: Fix many outstanding issues for V8 release, ELPA Syncer, 2021/12/27
- [elpa] externals/hyperbole 5e7d92a5e6 4/7: Fix a few minor issues pointed out by Elisp linter, ELPA Syncer, 2021/12/27
- [elpa] externals/hyperbole 7d58968353 6/7: Merge 'master' (Mats updates) of hyperbole, ELPA Syncer, 2021/12/27
- [elpa] externals/hyperbole 4e1f1b03e9 7/7: Fix tests that failed on Emacs 27.1., ELPA Syncer, 2021/12/27