Skip to content

Commit

Permalink
Change kotl-mode:mail-tree binding from {C-c @} to {C-c C-@}
Browse files Browse the repository at this point in the history
  • Loading branch information
rswgnu committed May 11, 2021
1 parent c501027 commit a227270
Show file tree
Hide file tree
Showing 13 changed files with 92 additions and 49 deletions.
10 changes: 10 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
2021-05-10 Bob Weiner <[email protected]>

* kotl/kview.el (kcell-view:label): Remove unneeded properties
from returned string.

* man/hyperbole.texi (Relocating and Copying, Koutliner Keys):
kotl/kotl-mode.el (kotl-mode-map): Change binding of
kotl-mode:mail-tree from {C-c @} to {C-c C-@} to
prevent conflict with hycontrol-windows-grid binding.

2021-05-09 Bob Weiner <[email protected]>

* test/demo-tests.el (demo-org-hide-header-test): Fix, add
Expand Down
2 changes: 1 addition & 1 deletion DEMO
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ If you ever need to experiment with different sized window grids, use
for a grid size and then display it. When you are done, simply press RET
to exit.

Outside of HyControl, you can invoke the grid of windows command with C-c @
Outside of HyControl, you can invoke the grid of windows command with {C-c @}
in most buffers.

There is lots more to discover in HyControl as you explore.
Expand Down
6 changes: 6 additions & 0 deletions HY-NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,12 @@
Koutliner via Org table minor mode. Use {M-x orgtbl-mode RET} to
toggle this on and off. See "(Org)Tables" for details.

- New Mail Tree Key Binding: The kotl-mode:mail-tree command that
extracts the current view of a Koutline in text-only format and
creates an outgoing email messge with it, has moved from {C-c @}
to {C-c C-@} to prevent conflict with the hycontrol-window-grid
command bound to {C-c @}.

- New Tree Demotion/Promotion Keys: Tree promotion and demotion keys now
match the defaults in Org mode and Outline mode, plus some easier to
type ones. The tables below summarize which keys work whether inside
Expand Down
39 changes: 22 additions & 17 deletions hsys-org.el
Original file line number Diff line number Diff line change
Expand Up @@ -169,23 +169,28 @@ uses that one. Otherwise, triggers an error."
"Return non-nil iff point is on an Org mode link.
Assume caller has already checked that the current buffer is in `org-mode'
or are looking for an Org link in another buffer type."
(let* ((context
;; Only consider supported types, even if they are not
;; the closest one.
(org-element-lineage
(org-element-context)
'(clock footnote-definition footnote-reference headline
inlinetask link timestamp)
t))
(type (org-element-type context)))
(or (eq type 'link)
(and (boundp 'org-link-bracket-re)
(org-in-regexp org-link-bracket-re))
(and (boundp 'org-bracket-link-regexp)
(org-in-regexp org-bracket-link-regexp))
(and (boundp 'org-target-link-regexp)
(not (null org-target-link-regexp))
(org-in-regexp org-target-link-regexp)))))
;; If any Org test fails, just return nil
(condition-case ()
(let* ((context
;; Only consider supported types, even if they are not
;; the closest one.
(org-element-lineage
;; Next line can trigger an error when `looking-at' is called
;; with a `nil' value of `org-complex-heading-regexp'.
(org-element-context)
'(clock footnote-definition footnote-reference headline
inlinetask link timestamp)
t))
(type (org-element-type context)))
(or (eq type 'link)
(and (boundp 'org-link-bracket-re)
(org-in-regexp org-link-bracket-re))
(and (boundp 'org-bracket-link-regexp)
(org-in-regexp org-bracket-link-regexp))
(and (boundp 'org-target-link-regexp)
(not (null org-target-link-regexp))
(org-in-regexp org-target-link-regexp))))
(error nil)))

;; Assume caller has already checked that the current buffer is in org-mode.
(defun hsys-org-heading-at-p (&optional _)
Expand Down
23 changes: 15 additions & 8 deletions hyperbole.el
Original file line number Diff line number Diff line change
Expand Up @@ -410,8 +410,9 @@ frame, those functions by default still return the prior frame."
;;; ************************************************************************

;; New autoload generation function defined only in Emacs 28
(unless (fboundp #'make-directory-autoloads)
(defalias 'make-directory-autoloads 'update-directory-autoloads))
;; (unless (fboundp #'make-directory-autoloads)
;; ;; Don't use defalias on next line; causes a failure
;; (fset 'make-directory-autoloads 'update-directory-autoloads))

;; Koutliner autoloads in the kotl/ subdirectory are generated by 'make pkg'.
;; This next line ensures they are loaded by hyperbole-autoloads whenever
Expand Down Expand Up @@ -450,7 +451,7 @@ frame, those functions by default still return the prior frame."
;; (backup-inhibited t)
;; (version-control 'never))
;; (package-autoload-ensure-default-file generated-autoload-file)
;; (apply #'make-directory-autoloads pkg-dir
;; (apply #'update-directory-autoloads pkg-dir
;; (delq nil (mapcar (lambda (f) (and (file-directory-p f)
;; (not (file-symlink-p f))
;; f))
Expand Down Expand Up @@ -661,11 +662,17 @@ This is used only when running from git source and not a package release."
(defun hyperb:generate-autoloads ()
"Renerate Hyperbole *-autoload.el files whether they already exist or not."
(let* ((default-directory hyperb:dir)
(generated-autoload-file (expand-file-name "hyperbole-autoloads.el"))
(backup-inhibited t))
(make-directory-autoloads ".")
(setq generated-autoload-file (expand-file-name "kotl/kotl-autoloads.el"))
(make-directory-autoloads "kotl/"))
(backup-inhibited t)
(al-file (expand-file-name "hyperbole-autoloads.el"))
(generated-autoload-file))
;; (make-local-variable 'generated-autoload-file)
(with-current-buffer (find-file-noselect al-file)
(setq generated-autoload-file al-file)
(update-directory-autoloads "."))
(setq al-file (expand-file-name "kotl/kotl-autoloads.el"))
(with-current-buffer (find-file-noselect al-file)
(setq generated-autoload-file al-file)
(update-directory-autoloads "kotl/")))
(unless (hyperb:autoloads-exist-p)
(error (format "Hyperbole failed to generate autoload files; try running 'make src' in a shell in %s" hyperb:dir))))

Expand Down
4 changes: 2 additions & 2 deletions kotl/EXAMPLE.kotl
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@
don't use them to move trees across different outline files. You
can, however, copy an outline tree to a non-outline buffer with:
{C-c M-c} - Copy a koutline tree to a non-koutline buffer.
{C-c @} - Copy a koutline tree to an outgoing mail message.
{C-c C-@} - Copy a koutline tree to an outgoing mail message.

{C-c c} - Copy <tree> to follow as sibling of <cell>.
{C-u C-c c} - Copy <tree> to follow as first child of <cell>.
Expand Down Expand Up @@ -369,7 +369,7 @@ alpha ;; label-type

;; depth-first kcell attributes
[[0
(creator "[email protected]" create-time "20170928:19:50:05" id-counter 77 file "/Users/bk/sw-dev/emacs/hyperbole/kotl/EXAMPLE.kotl")]
(creator "[email protected]" create-time "20210510:04:09:59" id-counter 77 file "/Users/bk/Dropbox/emacs/hyperbole/kotl/EXAMPLE.kotl")]
[20
(creator "[email protected]" create-time "19940104:17:38:28" no-fill t)]
[75
Expand Down
20 changes: 14 additions & 6 deletions kotl/kotl-autoloads.el
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@ Return the new kview.
\(fn FILE-NAME)" t nil)

(autoload 'kfile:is-p "kfile" "\
Iff current buffer contains an unformatted or formatted koutline, return file format version string, else nil." nil nil)
Iff current buffer contains an unformatted or formatted koutline, return file format version string, else nil.
\(fn)" nil nil)

(autoload 'kfile:view "kfile" "\
View an existing kotl version-2 file FILE-NAME in a read-only mode.
Expand Down Expand Up @@ -194,10 +196,14 @@ See documentation for `kcell:ref-to-id' for valid cell-ref formats.
(autoload 'kotl-mode "kotl-mode" "\
The major mode used to edit and view koutlines.
It provides the following keys:
\\{kotl-mode-map}" t nil)
\\{kotl-mode-map}
\(fn)" t nil)

(autoload 'kotl-mode:example "kotl-mode" "\
Display the Koutliner example file for demonstration use by a user." t nil)
Display the Koutliner example file for demonstration use by a user.
\(fn)" t nil)

(autoload 'kotl-mode:overview "kotl-mode" "\
Show the first line of each cell.
Expand Down Expand Up @@ -229,9 +235,11 @@ Display fully expanded tree rooted at CELL-REF.
\(fn &optional CELL-REF)" t nil)

(autoload 'kotl-mode:is-p "kotl-mode" "\
Signal an error if current buffer is not a Hyperbole outline, else return t." nil nil)
Signal an error if current buffer is not a Hyperbole outline, else return t.
\(fn)" nil nil)

(register-definition-prefixes "kotl-mode" '("delete-selection-pre-hook" "kotl-mode" "yank-"))
(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "kotl-mode" '("delete-selection-pre-hook" "kotl-mode" "yank-")))

;;;***

Expand Down Expand Up @@ -259,7 +267,7 @@ Signal an error if current buffer is not a Hyperbole outline, else return t." ni
;;;### (autoloads nil "kview" "kview.el" (0 0 0 0))
;;; Generated autoloads from kview.el

(register-definition-prefixes "kview" '("kcell-view:" "kview:"))
(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "kview" '("kcell-view:" "kview:")))

;;;***

Expand Down
15 changes: 11 additions & 4 deletions kotl/kotl-mode.el
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,12 @@ It provides the following keys:
;; defined in kfill.el, so reload it.
(load "kfill"))
(setq-local fill-paragraph-function #'kfill:fill-paragraph)
;;
;; Prevent insertion of characters outside of editable bounds,
;; e.g. after the mouse sets point to a non-editable position
(add-hook 'pre-command-hook #'kotl-mode:pre-self-insert-command)
;; !! TODO: This was causing kotl-mode:demote-tree (and promote) to fail
;; (add-hook 'pre-command-hook #'kotl-mode:pre-self-insert-command)
;;
;; Ensure that outline structure data is saved when save-buffer is called
;; from save-some-buffers, {C-x s}.
(add-hook 'local-write-file-hooks #'kotl-mode:update-buffer)
Expand Down Expand Up @@ -2908,8 +2911,12 @@ newlines at end of tree."
"If within a Koutline, prior to inserting a character, ensure point is in an editable position.
Mouse may have moved point outside of an editable area. kotl-mode adds
this function to `pre-command-hook'."
(when (and (eq major-mode 'kotl-mode)
(not (kview:valid-position-p)))
(when (and (eq this-command 'self-insert-command)
(called-interactively-p 'interactive)
(eq major-mode 'kotl-mode)
(not (kview:valid-position-p))
;; Prevent repeatedly moving point to valid position when moving trees
(not (hyperb:stack-frame '(kcell-view:to-label-end))))
(let ((start (kcell-view:start))
(end (kcell-view:end-contents)))
(cond ((and (<= start (point)) (<= (point) end))
Expand Down Expand Up @@ -3169,7 +3176,7 @@ Leave point at end of line now residing at START."


;; kotl-mode keys
(define-key kotl-mode-map "\C-c@" 'kotl-mode:mail-tree)
(define-key kotl-mode-map "\C-c\C-@" 'kotl-mode:mail-tree)
(define-key kotl-mode-map "\C-c+" 'kotl-mode:append-cell)
(define-key kotl-mode-map "\C-c," 'kotl-mode:beginning-of-cell)
(define-key kotl-mode-map "\C-c." 'kotl-mode:end-of-cell)
Expand Down
4 changes: 2 additions & 2 deletions kotl/kview.el
Original file line number Diff line number Diff line change
Expand Up @@ -325,8 +325,8 @@ If labels are off, return cell's idstamp as a string."
(if (eq label-type 'no)
(kcell-view:idstamp)
(kcell-view:to-label-end)
(buffer-substring (point) (progn (skip-chars-backward "^ \t\n\r")
(point)))))))
(buffer-substring-no-properties (point) (progn (skip-chars-backward "^ \t\n\r")
(point)))))))

(defun kcell-view:level (&optional pos label-sep-len indent)
"Return the outline level of the current cell or the one at optional POS.
Expand Down
14 changes: 7 additions & 7 deletions man/hyperbole.html
Original file line number Diff line number Diff line change
Expand Up @@ -5389,9 +5389,9 @@ <h2 class="contents-heading">Table of Contents</h2>
</dd>
<dt><kbd>{C-c M-c}</kbd></dt>
<dd><p>Copy a &lt;tree&gt; to a non-koutline buffer.
<span id="index-C_002dc-_0040"></span>
<span id="index-C_002dc-C_002d_0040"></span>
</p></dd>
<dt><kbd>{C-c @ }</kbd></dt>
<dt><kbd>{C-c C-@ }</kbd></dt>
<dd><p>Copy a &lt;tree&gt; to an outgoing mail message.
</p></dd>
</dl>
Expand Down Expand Up @@ -8917,11 +8917,11 @@ <h2 class="contents-heading">Table of Contents</h2>
prior to loading Hyperbole; otherwise, the Find/Web minibuffer menu
item, <kbd>{C-h h f w}</kbd>, will do the same thing.
</p>
<span id="index-C_002dc-_0040-1"></span>
<span id="index-C_002dc-_0040"></span>
<span id="index-key-binding_002c-C_002dc-_0040"></span>
<span id="index-windows-grid-1"></span>
<span id="index-grid-of-windows-1"></span>
<span id="index-C_002dc-_0040-2"></span>
<span id="index-C_002dc-_0040-1"></span>
</dd>
<dt><kbd>{C-c @}</kbd></dt>
<dd><p>Display a grid of windows in the selected frame, sized according to the
Expand Down Expand Up @@ -9475,7 +9475,7 @@ <h2 class="contents-heading">Table of Contents</h2>
</p>
<span id="index-kotl_002dmode_003amail_002dtree"></span>
</dd>
<dt><code>kotl-mode:mail-tree <kbd>{C-c @}</kbd></code></dt>
<dt><code>kotl-mode:mail-tree <kbd>{C-c C-@}</kbd></code></dt>
<dd><p>Mail outline tree rooted at CELL-REF. Use &quot;0&quot; for whole outline buffer.
</p>
<span id="index-kotl_002dmode_003amove_002dafter"></span>
Expand Down Expand Up @@ -12153,10 +12153,10 @@ <h2 class="contents-heading">Table of Contents</h2>
<tr><td></td><td valign="top"><a href="#index-C_002dc-_002f-2"><code>C-c /</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Default-Hyperbole-Bindings">Default Hyperbole Bindings</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-C_002dc-_003c"><code>C-c &lt;</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Moving-Around">Moving Around</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-C_002dc-_003e"><code>C-c &gt;</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Moving-Around">Moving Around</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-C_002dc-_0040"><code>C-c @</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Relocating-and-Copying">Relocating and Copying</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-C_002dc-_0040"><code>C-c @</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Default-Hyperbole-Bindings">Default Hyperbole Bindings</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-C_002dc-_0040-1"><code>C-c @</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Default-Hyperbole-Bindings">Default Hyperbole Bindings</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-C_002dc-_0040-2"><code>C-c @</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Default-Hyperbole-Bindings">Default Hyperbole Bindings</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-C_002dc-c"><code>C-c c</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Relocating-and-Copying">Relocating and Copying</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-C_002dc-C_002d_0040"><code>C-c C-@</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Relocating-and-Copying">Relocating and Copying</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-C_002dc-C_002da"><code>C-c C-a</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Hiding-and-Showing">Hiding and Showing</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-C_002dc-C_002db"><code>C-c C-b</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Moving-Around">Moving Around</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-C_002dc-C_002dc"><code>C-c C-c</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Implicit-Button-Types">Implicit Button Types</a></td></tr>
Expand Down
Binary file modified man/hyperbole.info
Binary file not shown.
Binary file modified man/hyperbole.pdf
Binary file not shown.
4 changes: 2 additions & 2 deletions man/hyperbole.texi
Original file line number Diff line number Diff line change
Expand Up @@ -4523,7 +4523,7 @@ You can, however, copy an outline tree to a non-outline buffer with:
@table @asis
@kitem C-c M-c
Copy a <tree> to a non-koutline buffer.
@kitem C-c @@
@kitem C-c C-@@
Copy a <tree> to an outgoing mail message.
@end table

Expand Down Expand Up @@ -8105,7 +8105,7 @@ Leave point at the start of the cell or at its present position if it is
already within the last sibling cell.

@findex kotl-mode:mail-tree
@item kotl-mode:mail-tree @bkbd{C-c @@}
@item kotl-mode:mail-tree @bkbd{C-c C-@@}
Mail outline tree rooted at CELL-REF. Use "0" for whole outline buffer.

@findex kotl-mode:move-after
Expand Down

0 comments on commit a227270

Please sign in to comment.