emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [NonGNU ELPA] New packages: corfu-doc and corfu-doc-terminal


From: Stefan Monnier
Subject: Re: [NonGNU ELPA] New packages: corfu-doc and corfu-doc-terminal
Date: Sat, 28 May 2022 11:02:11 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)

Hi,

Akib just suggested we add `corfu-doc` to NonGNU ELPA but it seems like
you have signed the copyright paperwork so we could add it to GNU ELPA.
I think that would be a great addition.
Are you OK with it?

This assumes you'll be careful to make sure future contributors have
signed copyright paperwork as well, and also you'll need to change the
Copyright line in the file (which is a way to state that you consider
this file as covered by the copyright assignment you recently signed).

Also, while I'm here, I attach a patch resulting from my superficial
reading of your code.

Thank you for your contribution to Emacs,


        Stefan
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000000..39090e0af5
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,3 @@
+*.elc
+/corfu-doc-autoloads.el
+/corfu-doc-pkg.el
diff --git a/corfu-doc.el b/corfu-doc.el
index eed0bbbaaa..014804e4f7 100644
--- a/corfu-doc.el
+++ b/corfu-doc.el
@@ -1,6 +1,6 @@
 ;;; corfu-doc.el --- Documentation popup for Corfu -*- lexical-binding: t -*-
 
-;; Copyright (C) 2021-2022 Yuwei Tian
+;; Copyright (C) 2021-2022  Free Software Foundation, Inc.
 
 ;; Author: Yuwei Tian <ibluefocus@NOSPAM.gmail.com>
 ;; URL: https://github.com/galeo/corfu-doc
@@ -44,14 +44,12 @@
 
 (defcustom corfu-doc-auto t
   "Display documentation popup automatically."
-  :type 'boolean
-  :group 'corfu-doc)
+  :type 'boolean)
 
 (defcustom corfu-doc-delay 0.1
   "The number of seconds to wait before displaying the documentation popup."
   :type 'float
-  :safe #'floatp
-  :group 'corfu-doc)
+  :safe #'floatp)
 
 (defcustom corfu-doc-hide-threshold 0.2
   "Threshold value to hide the documentation popup when browsing candidates.
@@ -60,28 +58,24 @@ When the selected candidate is changed, if the value of 
`corfu-doc-delay'
 is greater than this threshold value, the documentation popup frame will
 be hided immediately. Else, just clear the doc frame content."
   :type 'float
-  :safe #'floatp
-  :group 'corfu-doc)
+  :safe #'floatp)
 
 (defcustom corfu-doc-max-width 60
   "The max width of the corfu doc frame in characters."
   :type 'integer
-  :safe #'integerp
-  :group 'corfu-doc)
+  :safe #'integerp)
 
 (defcustom corfu-doc-max-height 10
   "The max height of the corfu doc frame in characters."
   :type 'integer
-  :safe #'integerp
-  :group 'corfu-doc)
+  :safe #'integerp)
 
 (defcustom corfu-doc-resize-frame t
   "Non-nil means resize the corfu doc frame automatically.
 
 If this is nil, do not resize corfu doc frame automatically."
   :type 'boolean
-  :safe #'booleanp
-  :group 'corfu-doc)
+  :safe #'booleanp)
 
 (defcustom corfu-doc-display-within-parent-frame nil
   "Display the doc frame within the parent frame.
@@ -100,8 +94,7 @@ still being visible themselves.
 
 Please see \"(elisp) Child Frames\" in Emacs manual for details."
   :type 'boolean
-  :safe #'booleanp
-  :group 'corfu-doc)
+  :safe #'booleanp)
 
 (defvar corfu-doc--frame nil
   "Doc frame.")
@@ -443,12 +436,14 @@ FWIDTH and FHEIGHT."
   :global t
   :group 'corfu
   (cond
-    (corfu-doc-mode
-     (advice-add 'corfu--popup-show :after #'corfu-doc--popup-show)
-     (advice-add 'corfu--popup-hide :after #'corfu-doc--popup-hide))
-    (t
-     (advice-remove 'corfu--popup-show #'corfu-doc--popup-show)
-     (advice-remove 'corfu--popup-hide #'corfu-doc--popup-hide))))
+   (corfu-doc-mode
+    (corfu-doc--manual-popup-show)
+    (advice-add 'corfu--popup-show :after #'corfu-doc--popup-show)
+    (advice-add 'corfu--popup-hide :after #'corfu-doc--popup-hide))
+   (t
+    (corfu-doc--popup-hide)
+    (advice-remove 'corfu--popup-show #'corfu-doc--popup-show)
+    (advice-remove 'corfu--popup-hide #'corfu-doc--popup-hide))))
 
 (defun corfu-doc--popup-support-p ()
   (display-graphic-p))
@@ -528,18 +523,7 @@ corfu doc mode is turned on and `corfu-doc-auto' is set to 
Non-nil."
     (advice-add 'corfu--popup-show :after #'corfu-doc--popup-show)))
 
 ;;;###autoload
-(defun toggle-corfu-doc-mode (&optional arg)
-  "Toggles corfu doc mode on or off.
-With optional ARG, turn corfu doc mode on if and only if ARG is positive."
-  (interactive "P")
-  (if (null arg)
-      (setq arg (if corfu-doc-mode -1 1))
-    (setq arg (prefix-numeric-value arg)))
-  (if (> arg 0)
-      (corfu-doc--manual-popup-show)
-    (corfu-doc--popup-hide))
-  (corfu-doc-mode arg))
-
+(define-obsolete-function-alias 'toggle-corfu-doc-mode #'corfu-doc-mode "0.7")
 
 (provide 'corfu-doc)
 ;;; corfu-doc.el ends here

reply via email to

[Prev in Thread] Current Thread [Next in Thread]