branch: externals/hyperbole commit ed8a8e05de33e3eb8b1df0f6d83ae120e7c4f7e3 Author: Bob Weiner <r...@gnu.org> Commit: Bob Weiner <r...@gnu.org>
HY-TALK/HYPB - Move all interaction log setup code to hypb.el --- HY-TALK/HYPB | 60 ++++-------------------------------------------------------- hypb.el | 11 +++++++---- 2 files changed, 11 insertions(+), 60 deletions(-) diff --git a/HY-TALK/HYPB b/HY-TALK/HYPB index d9f74d7b0b..34d416f29b 100644 --- a/HY-TALK/HYPB +++ b/HY-TALK/HYPB @@ -22,62 +22,10 @@ or interactively after loading Hyperbole: ** interaction-log Package - font-lock highlighted log of keys and commands Used for EmacsConf 2022 - Install: <unless (package-installed-p 'interaction-log) (package-install 'interaction-log)> - Load: <load-library "interaction-log"> - - Configure: - <progn - Install: <unless (package-installed-p 'keypression) (package-install 'keypression)> - - (setq ilog-display-state 'commands - ilog-print-lambdas 'not-compiled) - (mapc (lambda (cmd-str) (push (format "^%s$" cmd-str) ilog-self-insert-command-regexps)) - '("hyperbole" "hui:menu-enter")) - (interaction-log-mode 0) - - (global-set-key - (kbd "C-h C-l") - (lambda () (interactive) (display-buffer ilog-buffer-name))) - - (defun ilog-show-in-new-frame () - "Display log in a pop up frame of width 41 with parameters of selected frame." - (interactive) - (require 'hycontrol) - (unless interaction-log-mode (interaction-log-mode +1)) - (let ((params (frame-parameters))) - (setcdr (assq 'width params) 41) - (let ((win (display-buffer-pop-up-frame - (get-buffer ilog-buffer-name) - (list (cons 'pop-up-frame-parameters params))))) - (set-window-dedicated-p win t) - (select-frame (window-frame win)) - (hycontrol-frame-to-right-center) - win))) - - (define-minor-mode interaction-log-mode - "Global minor mode logging keys, commands, file loads and messages. - Logged stuff goes to the *Emacs Log* buffer." - :group 'interaction-log - :lighter nil - :global t - :after-hook interaction-log-mode-hook - (if interaction-log-mode - (progn - (add-hook 'after-change-functions #'ilog-note-buffer-change) - (add-hook 'post-command-hook #'ilog-record-this-command) - (add-hook 'post-command-hook #'ilog-post-command) - (setq ilog-truncation-timer (run-at-time 30 30 #'ilog-truncate-log-buffer)) - (setq ilog-insertion-timer (run-with-timer ilog-idle-time ilog-idle-time - #'ilog-timer-function)) - (message "Interaction Log: started logging in %s" ilog-buffer-name) - (easy-menu-add ilog-minor-mode-menu)) - (remove-hook 'after-change-functions #'ilog-note-buffer-change) - (remove-hook 'post-command-hook #'ilog-record-this-command) - (remove-hook 'post-command-hook #'ilog-post-command) - (when (timerp ilog-truncation-timer) (cancel-timer ilog-truncation-timer)) - (setq ilog-truncation-timer nil) - (when (timerp ilog-insertion-timer) (cancel-timer ilog-insertion-timer)) - (setq ilog-insertion-timer nil)))> + Install, + Load, + Configure, + Activate: <hypb:activate-interaction-log-mode> Activate: <interaction-log-mode 1> Deactivate: <interaction-log-mode 0> diff --git a/hypb.el b/hypb.el index 175ed74d73..a292bd96f3 100644 --- a/hypb.el +++ b/hypb.el @@ -3,7 +3,7 @@ ;; Author: Bob Weiner ;; ;; Orig-Date: 6-Oct-91 at 03:42:38 -;; Last-Mod: 31-Oct-22 at 03:08:23 by Bob Weiner +;; Last-Mod: 5-Nov-22 at 10:36:08 by Bob Weiner ;; ;; Copyright (C) 1991-2022 Free Software Foundation, Inc. ;; See the "HY-COPY" file for license information. @@ -51,15 +51,18 @@ It must end with a space." ;;; Public functions ;;; ************************************************************************ +;;;###autoload (defun hypb:activate-interaction-log-mode () "Configure and enable the interaction-log package for use with Hyperbole. This displays a clean log of Emacs keys used and commands executed." (interactive) ;; Ensure package is installed - (unless (package-installed-p 'keypression) (package-install 'keypression)) + (unless (package-installed-p 'interaction-log) + (package-install 'interaction-log)) ;; Ensure interaction-log-mode is disabled to removes its command ;; hooks which are replaced below. + (require 'interaction-log) (interaction-log-mode 0) ;; Optional binding you can enable to display the ilog buffer @@ -738,8 +741,8 @@ Removes any trailing newline at the end of the output." (defun hypb:rgrep (pattern &optional prefx-arg) "Recursively grep with symbol at point or PATTERN. Grep over all non-backup and non-autosave files in the current -directory tree. If in an Emacs Lisp mode buffer and no PREFX-ARG -is given, limit search to only .el and .el.gz files." +directory tree. If in an Emacs Lisp mode buffer and no optional +PREFIX-ARG is given, limit search to only .el and .el.gz files." (interactive (list (if (and (not current-prefix-arg) (equal (buffer-name) "*Locate*")) (read-string "Grep files listed here for: ") (let ((default (symbol-at-point)))