[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] scratch/hyperbole 02335b71bd 14/16: * hyrolo.el: A few cosmetic t
From: |
Stefan Monnier |
Subject: |
[elpa] scratch/hyperbole 02335b71bd 14/16: * hyrolo.el: A few cosmetic tweaks |
Date: |
Mon, 19 Jun 2023 22:36:45 -0400 (EDT) |
branch: scratch/hyperbole
commit 02335b71bd7de365b2dcf5978f4fc9c9d2125729
Author: Stefan Monnier <monnier@iro.umontreal.ca>
Commit: Stefan Monnier <monnier@iro.umontreal.ca>
* hyrolo.el: A few cosmetic tweaks
This file suffers from a large number of warnings, some of them
correspond to real bugs. This patch does *not* fix them.
Remove redundant `:group` args. Remove obsolete `*` in
`defcustom` docstrings.
(hyrolo--initialize-file-list): New function extracted (and simplified)
from `hyrolo-initialize-file-list`.
(hyrolo-file-list): Use it.
(hyrolo-initialize-file-list): Use it as well. Declare it as obsolete.
(hyrolo-yank-reformat-function): Give it a non-nil default value.
(hyrolo-yank): Blindly call it now that it can't be nil.
---
hyrolo.el | 85 +++++++++++++++++++++++++++------------------------------------
1 file changed, 36 insertions(+), 49 deletions(-)
diff --git a/hyrolo.el b/hyrolo.el
index 089a618ce6..191a748a72 100644
--- a/hyrolo.el
+++ b/hyrolo.el
@@ -71,11 +71,10 @@
:group 'hyperbole)
(defcustom hyrolo-date-format "%m/%d/%Y"
- "*Format of date string used in Rolo automatic date stamps.
+ "Format of date string used in Rolo automatic date stamps.
Default is American style. See documentation of the function
`format-time-string' for format options."
- :type 'string
- :group 'hyperbole-rolo)
+ :type 'string)
(defvar hyrolo-display-format-function
(lambda (entry)
@@ -84,37 +83,32 @@ Default is American style. See documentation of the
function
The argument is a rolo entry string.")
(defcustom hyrolo-email-format "%s\t\t<%s>"
- "*Format string to use when adding an entry with e-mail addr from a mail msg.
+ "Format string to use when adding an entry with e-mail addr from a mail msg.
It must contain a %s indicating where to put the entry name and a second
%s indicating where to put the e-mail address."
- :type 'string
- :group 'hyperbole-rolo)
+ :type 'string)
(defvar hyrolo-entry-name-regexp "[-_a-zA-Z0-9@.]+\\( ?, ?[-_a-zA-Z0-9@.]+\\)?"
"*Regexp matching a hyrolo entry name after matching to
`hyrolo-entry-regexp'.")
(defcustom hyrolo-file-suffix-regexp "\\.\\(kotl\\|md\\|org\\|otl\\)$"
"File suffix regexp used to select files to search with HyRolo."
- :type 'string
- :group 'hyperbole-rolo)
+ :type 'string)
(defcustom hyrolo-find-file-function #'find-file
- "*Function to interactively display a `hyrolo-file-list' file for editing.
+ "Function to interactively display a `hyrolo-file-list' file for editing.
Use the `hyrolo-edit' function instead to edit a new or existing entry."
- :type 'function
- :group 'hyperbole-rolo)
+ :type 'function)
(defcustom hyrolo-find-file-noselect-function #'find-file-noselect
- "*Function used by HyRolo to read `hyrolo-file-list' files into Emacs."
- :type 'function
- :group 'hyperbole-rolo)
+ "Function used by HyRolo to read `hyrolo-file-list' files into Emacs."
+ :type 'function)
(defcustom hyrolo-google-contacts-flag t
- "*Non-nil means search Google Contacts on each hyrolo query.
+ "Non-nil means search Google Contacts on each hyrolo query.
The google-contact package must be loaded and a gpg encryption
executable must be found as well (for Oauth security)."
- :type 'boolean
- :group 'hyperbole-rolo)
+ :type 'boolean)
(defvar hyrolo-next-match-function #'hyrolo-next-regexp-match
"Value is the function to find next match within a HyRolo file.
@@ -157,29 +151,26 @@ use."
;; '("~/.rolo.otl" "~/.rolo.org")
+(defun hyrolo--initialize-file-list ()
+ (delq nil
+ (list "~/.rolo.otl"
+ (if (and (boundp 'bbdb-file) (stringp bbdb-file)) bbdb-file)
+ (when (hyrolo-google-contacts-p) google-contacts-buffer-name))))
+
;;;###autoload
(defun hyrolo-initialize-file-list (&optional force-init-flag)
"Initialize the list of files used for HyRolo search if not already
initialized."
+ (declare (obsolete nil "8.0.1"))
(interactive)
(when (or force-init-flag (not (boundp 'hyrolo-file-list)) (not
hyrolo-file-list))
- (let* ((gcontacts (when (hyrolo-google-contacts-p)
google-contacts-buffer-name))
- (ms "~/.rolo.otl")
- (posix "~/.rolo.otl")
- (list (delq nil (if (and (boundp 'bbdb-file) (stringp bbdb-file))
- (if hyperb:microsoft-os-p
- (list ms bbdb-file gcontacts)
- (list "~/.rolo.otl" bbdb-file gcontacts))
- (if hyperb:microsoft-os-p
- (list ms gcontacts)
- (list posix gcontacts))))))
- (setq hyrolo-file-list list)
- (when (called-interactively-p 'interactive)
- (message "HyRolo Search List: %S" list))
- list)))
+ (setq hyrolo-file-list (hyrolo--initialize-file-list))
+ (when (called-interactively-p 'interactive)
+ (message "HyRolo Search List: %S" hyrolo-file-list))
+ hyrolo-file-list))
(define-obsolete-variable-alias 'rolo-file-list 'hyrolo-file-list "06.00")
-(defcustom hyrolo-file-list (hyrolo-initialize-file-list)
- "*List of files containing rolo entries.
+(defcustom hyrolo-file-list (hyrolo--initialize-file-list)
+ "List of files containing rolo entries.
The first file should be a user-specific rolo file, typically in the home
directory.
@@ -188,34 +179,30 @@ A hyrolo-file consists of:
hyrolo-hdr-regexp;
(2) one or more rolo entries which each begin with
hyrolo-entry-regexp and may be nested."
- :group 'hyperbole-rolo
:type '(repeat file))
(defcustom hyrolo-highlight-face 'match
- "*Face used to highlight rolo search matches."
+ "Face used to highlight rolo search matches."
:type 'face
- :initialize #'custom-initialize-default
- :group 'hyperbole-rolo)
+ :initialize #'custom-initialize-default)
(defcustom hyrolo-kill-buffers-after-use nil
- "*Non-nil means kill rolo file buffers after searching them for entries.
+ "Non-nil means kill rolo file buffers after searching them for entries.
Only unmodified buffers are killed."
- :type 'boolean
- :group 'hyperbole-rolo)
+ :type 'boolean)
(defcustom hyrolo-save-buffers-after-use t
- "*Non-nil means save rolo file after an entry is killed."
- :type 'boolean
- :group 'hyperbole-rolo)
+ "Non-nil means save rolo file after an entry is killed."
+ :type 'boolean)
;; 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)
-(defvar hyrolo-yank-reformat-function nil
- "*A function of two arguments, START and END, invoked after a hyrolo-yank.
+(defvar hyrolo-yank-reformat-function #'ignore
+ "*A function of two arguments, START and END, invoked after a `hyrolo-yank'.
It should reformat the region given by the arguments to some preferred style.
-Default value is nil, meaning no reformmating is done.")
+Default value is to perform no reformatting.")
;;; ************************************************************************
;;; Commands
@@ -925,8 +912,8 @@ With optional ARG, turn them on iff ARG is positive."
(and (not (and arg (> (prefix-numeric-value arg) 0)))
(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)
+ (progn (remove-hook 'hyrolo-add-hook #'hyrolo-set-date)
+ (remove-hook 'hyrolo-edit-hook #'hyrolo-set-date)
(message "Rolo date stamps are now off."))
(add-hook 'hyrolo-add-hook #'hyrolo-set-date)
(add-hook 'hyrolo-edit-hook #'hyrolo-set-date)
@@ -1000,7 +987,7 @@ of a string."
(hyrolo-grep name -1)
(hyrolo-grep (regexp-quote name) -1))))
;; Let user reformat the region just yanked.
- (if (and (= found 1) (fboundp hyrolo-yank-reformat-function))
+ (if (= found 1)
(funcall hyrolo-yank-reformat-function start (point)))
found))
- [elpa] scratch/hyperbole 60cf4b3ab0 07/16: * hact.el: Fix broken lexical-binding cookie, (continued)
- [elpa] scratch/hyperbole 60cf4b3ab0 07/16: * hact.el: Fix broken lexical-binding cookie, Stefan Monnier, 2023/06/19
- [elpa] scratch/hyperbole 57d02f8456 09/16: hyperbole-autoloads.el: Remove needless definitions, Stefan Monnier, 2023/06/19
- [elpa] scratch/hyperbole 5aa8d7a577 10/16: * hycontrol.el (hycontrol-windows-mode-map): Don't autoload, Stefan Monnier, 2023/06/19
- [elpa] scratch/hyperbole fd3f79a9ee 15/16: * hargs.el (hargs:set-string-to-complete): Don't mess with windows, Stefan Monnier, 2023/06/19
- [elpa] scratch/hyperbole ab0338d714 05/16: Fix compilation of test file, Stefan Monnier, 2023/06/19
- [elpa] scratch/hyperbole 63e463172e 06/16: (kview:char-visible-p): Delete function, Stefan Monnier, 2023/06/19
- [elpa] scratch/hyperbole fbcfcc04a3 08/16: * hyperbole.el: Preload `kotl-autoloads`, Stefan Monnier, 2023/06/19
- [elpa] scratch/hyperbole fc7e33b5e5 11/16: * hui-select.el: Fix a few warnings and improve some docstrings, Stefan Monnier, 2023/06/19
- [elpa] scratch/hyperbole 12fa8e328d 12/16: (man-show): Fix miscompilation, Stefan Monnier, 2023/06/19
- [elpa] scratch/hyperbole 10ac3f59df 13/16: Fix a few minor miscompilations and warnings, Stefan Monnier, 2023/06/19
- [elpa] scratch/hyperbole 02335b71bd 14/16: * hyrolo.el: A few cosmetic tweaks,
Stefan Monnier <=
- [elpa] scratch/hyperbole a269d1536e 16/16: * hversion.el: Add FIXMEs., Stefan Monnier, 2023/06/19
- [elpa] scratch/hyperbole 824a71773c 04/16: Get rid of `hyperb:stack-frame`, Stefan Monnier, 2023/06/19