Skip to content

Commit

Permalink
HyRolo - Fix major-mode and reveal-mode issues affecting *HyRolo*
Browse files Browse the repository at this point in the history
  • Loading branch information
rswgnu committed Jan 28, 2024
1 parent 68564a0 commit 92ee298
Show file tree
Hide file tree
Showing 6 changed files with 452 additions and 218 deletions.
28 changes: 28 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,31 @@
2024-01-28 Bob Weiner <[email protected]>

* hyrolo.el (hyrolo-reveal-open-new-overlays, hyrolo-reveal-close-old-overlays):
Wrap 'funcall' in 'hyrolo-funcall-match' so uses HyRolo outline settings.

2024-01-27 Bob Weiner <[email protected]>

* hyrolo.el (hyrolo-google-contacts-insert-data): Remove local let of (child nil).
(hyrolo-edit, hyrolo-add): Call '(set-auto-mode t)' to change from any
HyRolo-specific major-mode for quick reading to the file's normal mode for editing.
(hyrolo--funcall-with-outline-regexp): Add to avoid setting 'outline-regexp'
with a 'let' and call from 'hyrolo-map-matches' and 'hyrolo-funcall-match'.

* hyrolo.el (hyrolo-auto-mode-alist): Add new variable to control major modes used
by files read in for HyRolo searches.
(hyrolo-find-file-noselect): Remove Org mode-specific logic and instead
utilize 'hyrolo-auto-mode-alist'.
(hyrolo-outline-mode): Add for use with .ou?tl files with HyRolo.
(hyrolo-min-matched-level): Ensure never returns less than 1.
(hyrolo--cache-major-mode): Use `hyrolo-auto-mode-alist' to override
the default `major-mode' used on file entry matches within the *HyRolo* buffer.
hypb.el (hypb:major-mode-from-file-name): Rename to 'hyrolo-major-mode-from-file-name'
and move to "hyrolo.el". Prefix 'auto-mode-alist' values with those in
'hyrolo-auto-mode-alist'.
hyrolo.el (hyrolo-any-file-type-problem-p): Rename call here of above function.
hyrolo-logic.el (hyrolo-logic): Change call from 'hyrolo-find-file' to
'hyrolo-find-file-noselect' to enable use of 'hyrolo-auto-mode-alist'.

2024-01-23 Bob Weiner <[email protected]>

* hyrolo.el (hyrolo-reveal-ignore-this-command, hyrolo-reveal-open-new-overlays,
Expand Down
14 changes: 7 additions & 7 deletions hui-mouse.el
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
;; Author: Bob Weiner
;;
;; Orig-Date: 04-Feb-89
;; Last-Mod: 21-Jan-24 at 10:31:44 by Bob Weiner
;; Last-Mod: 27-Jan-24 at 11:29:19 by Bob Weiner
;;
;; SPDX-License-Identifier: GPL-3.0-or-later
;;
Expand Down Expand Up @@ -1948,12 +1948,12 @@ handled by the separate implicit button type, `org-link-outside-org-mode'."
"Non-nil means outline region was cut and is ready to be pasted at point.")

(eval-after-load "outline"
'(mapc (lambda (mode)
(add-hook mode (lambda ()
(make-local-variable 'smart-outline-cut)
;; Non-nil means outline region was cut
;; and is available to be pasted at point.
(setq smart-outline-cut nil))))
'(mapc (lambda (hook-var)
(add-hook hook-var (lambda ()
(make-local-variable 'smart-outline-cut)
;; Non-nil means outline region was cut
;; and is available to be pasted at point.
(setq smart-outline-cut nil))))
'(outline-mode-hook outline-minor-mode-hook)))

(defun smart-outline-level ()
Expand Down
47 changes: 1 addition & 46 deletions hypb.el
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
;; Author: Bob Weiner
;;
;; Orig-Date: 6-Oct-91 at 03:42:38
;; Last-Mod: 21-Jan-24 at 23:24:46 by Bob Weiner
;; Last-Mod: 27-Jan-24 at 12:39:34 by Bob Weiner
;;
;; SPDX-License-Identifier: GPL-3.0-or-later
;;
Expand Down Expand Up @@ -741,51 +741,6 @@ then `locate-post-command-hook'."
current-prefix-arg))
(locate search-string filter arg))


;; Adapted from `set-auto-mode' in "files.el".
;;;###autoload
(defun hypb:major-mode-from-file-name (name)
"Return `major-mode' function for file NAME from file name alone.
If no matching rule in `auto-mode-alist' or NAME is invalid,
return nil."
(when (stringp name)
(let ((remote-id (file-remote-p name))
(case-insensitive-p (file-name-case-insensitive-p
name))
mode)
;; Remove backup-suffixes from file name.
(setq name (file-name-sans-versions name))
;; Remove remote file name identification.
(when (and (stringp remote-id)
(string-match (regexp-quote remote-id) name))
(setq name (substring name (match-end 0))))
(while name
;; Find first matching alist entry.
(setq mode
(if case-insensitive-p
;; Filesystem is case-insensitive.
(let ((case-fold-search t))
(assoc-default name auto-mode-alist
'string-match))
;; Filesystem is case-sensitive.
(or
;; First match case-sensitively.
(let ((case-fold-search nil))
(assoc-default name auto-mode-alist
'string-match))
;; Fallback to case-insensitive match.
(and auto-mode-case-fold
(let ((case-fold-search t))
(assoc-default name auto-mode-alist
'string-match))))))
(if (and mode
(consp mode)
(cadr mode))
(setq mode (car mode)
name (substring name 0 (match-beginning 0)))
(setq name nil)))
mode)))

;;;###autoload
(defun hypb:map-plist (func plist)
"Apply FUNC of two args, key and value, to key-value pairs in PLIST."
Expand Down
4 changes: 2 additions & 2 deletions hyrolo-logic.el
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
;; Author: Bob Weiner
;;
;; Orig-Date: 13-Jun-89 at 22:57:33
;; Last-Mod: 20-Jan-24 at 15:42:21 by Mats Lidell
;; Last-Mod: 27-Jan-24 at 13:01:44 by Bob Weiner
;;
;; SPDX-License-Identifier: GPL-3.0-or-later
;;
Expand Down Expand Up @@ -188,7 +188,7 @@ Return the number of evaluations of SEXP that match entries."
(mapcar
(lambda (buf-or-file)
(setq buf-or-file (or (get-buffer buf-or-file)
(funcall hyrolo-find-file-noselect-function buf-or-file)))
(hyrolo-find-file-noselect buf-or-file)))
(hyrolo-map-logic sexp buf-or-file count-only include-sub-entries
no-sub-entries-out koutline-flag))
(cond ((null in-bufs) (hyrolo-get-file-list))
Expand Down
Loading

0 comments on commit 92ee298

Please sign in to comment.