Skip to content

Use lexical-binding #12

@monnier

Description

@monnier

Any reason why lexical binding is not enabled?
Also, hooks aren't functions, they are places where we can put functions.

So, I suggest a patch like:

diff --git a/boxquote.el b/boxquote.el
index af603984d6..5de210baf8 100644
--- a/boxquote.el
+++ b/boxquote.el
@@ -1,4 +1,4 @@
-;;; boxquote.el --- Quote text with a semi-box  -*- lexical-binding: nil -*-
+;;; boxquote.el --- Quote text with a semi-box  -*- lexical-binding:t -*-
 
 ;; Copyright 1999-2022 by Dave Pearson <davep@davep.org>
 
@@ -32,7 +32,7 @@
 ;; `----
 ;;
 ;; A number of functions are provided for quoting a region, a buffer, a
-;; paragraph and a defun. There are also functions for quoting text while
+;; paragraph and a defun.  There are also functions for quoting text while
 ;; pulling it in, either by inserting the contents of another file or by
 ;; yanking text into the current buffer.
 ;;
@@ -74,71 +74,59 @@
 
 (defcustom boxquote-top-and-tail "----"
   "Text that will be used at the top and tail of the box."
-  :type  'string
-  :group 'boxquote)
+  :type  'string)
 
 (defcustom boxquote-top-corner ","
   "Text used for the top corner of the box."
-  :type  'string
-  :group 'boxquote)
+  :type  'string)
 
 (defcustom boxquote-bottom-corner "`"
   "Text used for the bottom corner of the box."
-  :type  'string
-  :group 'boxquote)
+  :type  'string)
 
 (defcustom boxquote-side "| "
   "Text used for the side of the box."
-  :type  'string
-  :group 'boxquote)
+  :type  'string)
 
 (defcustom boxquote-title-format "[ %s ]"
   "Format string to use when creating a box title."
-  :type  'string
-  :group 'boxquote)
+  :type  'string)
 
 (defcustom boxquote-title-files t
   "Should a `boxquote-insert-file' title the box with the file name?"
   :type '(choice
           (const :tag "Title the box with the file name" t)
-          (const :tag "Don't title the box with the file name" nil))
-  :group 'boxquote)
+          (const :tag "Don't title the box with the file name" nil)))
 
 (defcustom boxquote-file-title-function #'file-name-nondirectory
   "Function to apply to a file's name when using it to title a box."
-  :type  'function
-  :group 'boxquote)
+  :type  'function)
 
 (defcustom boxquote-title-buffers t
   "Should a `boxquote-insert-buffer' title the box with the buffer name?"
   :type '(choice
           (const :tag "Title the box with the buffer name" t)
-          (const :tag "Don't title the box with the buffer name" nil))
-  :group 'boxquote)
+          (const :tag "Don't title the box with the buffer name" nil)))
 
 (defcustom boxquote-buffer-title-function #'identity
   "Function to apply to a buffer's name when using it to title a box."
-  :type  'function
-  :group 'boxquote)
+  :type  'function)
 
 (defcustom boxquote-region-hook nil
-  "Hooks to perform when on a region prior to boxquoting.
+  "Hook run on a region prior to boxquoting.
 
 Note that all forms of boxquoting use `boxquote-region' to create the
-boxquote. Because of this any hook you place here will be invoked by any of
+boxquote.  Because of this any hook you place here will be invoked by any of
 the boxquoting functions."
-  :type  'hook
-  :group 'boxquote)
+  :type  'hook)
 
 (defcustom boxquote-yank-hook nil
-  "Hooks to perform on the yanked text prior to boxquoting."
-  :type  'hook
-  :group 'boxquote)
+  "Hook run on the yanked text prior to boxquoting."
+  :type  'hook)
 
 (defcustom boxquote-insert-file-hook nil
-  "Hooks to perform on the text from an inserted file prior to boxquoting."
-  :type  'hook
-  :group 'boxquote)
+  "Hook run on the text from an inserted file prior to boxquoting."
+  :type  'hook)
 
 (defcustom boxquote-kill-ring-save-title #'buffer-name
   "Function for working out the title for a `boxquote-kill-ring-save'.
@@ -157,33 +145,27 @@ In this case, if you are a `gnus' user, \\[boxquote-kill-ring-save] could be
 used to copy text from an article buffer and, when it is yanked into another
 buffer using \\[boxquote-yank], the title of the boxquote would be the ID of
 the article you'd copied the text from."
-  :type  'function
-  :group 'boxquote)
+  :type  'function)
 
 (defcustom boxquote-describe-function-title-format "C-h f %s RET"
   "Format string to use when formatting a function description box title."
-  :type  'string
-  :group 'boxquote)
+  :type  'string)
 
 (defcustom boxquote-describe-variable-title-format "C-h v %s RET"
   "Format string to use when formatting a variable description box title."
-  :type  'string
-  :group 'boxquote)
+  :type  'string)
 
 (defcustom boxquote-describe-key-title-format "C-h k %s"
   "Format string to use when formatting a key description box title."
-  :type  'string
-  :group 'boxquote)
+  :type  'string)
 
 (defcustom boxquote-where-is-title-format "C-h w %s RET"
   "Format string to use when formatting a `where-is' description box title."
-  :type  'string
-  :group 'boxquote)
+  :type  'string)
 
 (defcustom boxquote-where-is-body-format "%s is on %s"
   "Format string to use when formatting a `where-is' description."
-  :type  'string
-  :group 'boxquote)
+  :type  'string)
 
 ;;; Main code
 
@@ -257,7 +239,7 @@ NIL is returned if no boxquote is found."
 (defun boxquote-title (title)
   "Set the title of the current boxquote to TITLE.
 
-If TITLE is an empty string the title is removed. Note that
+If TITLE is an empty string the title is removed.  Note that
 the title will be formatted using `boxquote-title-format'."
   (interactive (list (read-from-minibuffer "Title: " (boxquote-get-title))))
   (save-excursion
@@ -404,7 +386,7 @@ whatever `boxquote-kill-ring-save-title' returned at the time."
 FUNCTION is the function to describe."
   (interactive
    (list
-    (completing-read "Describe function: " obarray 'fboundp t nil nil)))
+    (completing-read "Describe function: " obarray #'fboundp t nil nil)))
   (boxquote-text
    (save-window-excursion
      (substring-no-properties
@@ -435,7 +417,7 @@ VARIABLE is the variable to describe."
 
 If the call to this command is prefixed with \
 \\[universal-argument] you will also be
-prompted for a buffer. The key definition used will be taken from
+prompted for a buffer.  The key definition used will be taken from
 that buffer."
   (interactive "kDescribe key: ")
   (let ((from-buffer (if current-prefix-arg

Metadata

Metadata

Assignees

No one assigned

    Labels

    EnhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions