From: "João Pedro" <jpedrodeamorim@gmail.com>
To: Akib Azmain Turja <akib@disroot.org>,
Philip Kaludercic <philipk@posteo.net>
Cc: emacs-devel@gnu.org
Subject: Re: [NonGNU ELPA] New packages: popon, corfu-popup, flymake-popon
Date: Fri, 20 May 2022 01:37:29 -0300 [thread overview]
Message-ID: <87tu9k95va.fsf@gmail.com> (raw)
In-Reply-To: <87wneh71db.fsf@disroot.org>
[-- Attachment #1: Type: text/plain, Size: 1879 bytes --]
On Fri, May 20 2022 01:45, Akib Azmain Turja <akib@disroot.org> wrote:
> Well, many may not understand what does popon in the name mean, and this
> name change is just to reflect the main purpose of the package, allowing
> to use Corfu in terminal, in its name. corfu-terminal is mainly for
> terminal, as there is already a better solution for graphical interface.
Ohh, I get it! Welp, keeping corfu-terminal or going for corfu-popon now
is a matter of what you'd like to advertise more, the fact that it uses
popon.el, or the fact that it enables Corfu to be used on the terminal.
By your answer I can already suppose that the latter is more important
to you, in which case it makes total sense keeping corfu-terminal.
> But the other two packages are for both GUI and terminal. And
> flymake-popon uses but posframe on GUI by default, as child frames are
> nicer and more stable. I probably ought to name it flymake-posframe as
> posframe is the default, but when I started it it used Popon to show the
> popup, and the Popon interface is still the priority.
Aha! You would've beaten me to it! I have a version of flymake-posframe
in my Emacs configuration, which I copied and modified from a repo of
the same name (which isn't on any package archives, FYI) [1]. I could
send you my version of flymake-posframe and I could try yours out to see
which one works best, and maybe we could merge our implementations and
publish it! How about it? I attached my version in this email.
> Please don't hestitate to tell if you have any suggestions about the
> names or any other thing, I'm willing to hear from the community.
That's great! Thank you for your time on both answering my questions and
developing these packages.
Best,
--
João Pedro de Amorim Paula
IT undergraduate at Universidade Federal do Rio Grande do Norte (UFRN)
[-- Attachment #2: flymake-posframe.el --]
[-- Type: text/plain, Size: 6737 bytes --]
;;; flymake-posframe.el --- Display flymake diagnostics at point -*- lexical-binding: t; -*-
;; Copyright (C) 2018 Aya Igarashi
;; Author: Aya Igarashi <ladiclexxx@gmail.com>
;; URL: https://github.com/Ladicle/flymake-posframe
;; Keywords: convenience, languages, tools
;; Version: 1.0.0
;; Package-Requires: ((emacs "26.1") (posframe "0.4.2"))
;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with this program. If not, see <https://www.gnu.org/licenses/>.
;;; Commentary:
;; Display flymake message at point using a posframe.
;; Check out the README for more information.
;;; Code:
(require 'flymake)
(require 'posframe)
(require 'subr-x)
(defcustom flymake-posframe-error-prefix "!! "
"String to be displayed before every error line."
:group 'flymake-posframe
:type '(choice (const :tag "No prefix" nil)
string))
(defcustom flymake-posframe-warning-prefix "! "
"String to be displayed before every warning line."
:group 'flymake-posframe
:type '(choice (const :tag "No prefix" nil)
string))
(defcustom flymake-posframe-note-prefix "? "
"String to be displayed before every note line."
:group 'flymake-posframe
:type '(choice (const :tag "No prefix" nil)
string))
(defcustom flymake-posframe-buffer " *flymake-posframe-buffer*"
"Name of the flymake posframe buffer."
:group 'flymake-posframe
:type 'string)
(defcustom flymake-posframe-idle-delay 0.5
"Amount of seconds to wait before displaying the posframe.
If you'd like for the posframe to be displayed instantly, set
this to 0 instead of nil. When this variable is nil, we just fall
back to the default value."
:group 'flymake-posframe
:type 'float)
(defface flymake-posframe-face
'((t :inherit nil))
"The background color of the flymake-posframe frame.
Only the `background' and `:foreground' are used from this face."
:group 'flymake-posframe)
(defvar flymake-posframe--last-diag nil
"Last buffer diagnostics displayed in a Flymake posframe.")
(defvar flymake-posframe--last-position nil
"Last position for which a posframe for Flymake was displayed.")
(defvar flymake-posframe--hide-posframe-hooks
'(pre-command-hook post-command-hook focus-out-hook)
"The hooks which should trigger automatic removal of the posframe.")
(defvar flymake-posframe--prefix-alist
'((:error . flymake-posframe-error-prefix)
(:warning . flymake-posframe-warning-prefix)
(:note . flymake-posframe-note-prefix))
"Alist of (DIAG-TYPE . PREFIX).
The DIAG-TYPE is the return of `flymake--diag-type' and PREFIX is
the prefix text to be shown for that type.")
(defvar flymake-posframe--face-alist
'((:error . error)
(:warning . warning)
(:note . success))
"Alist of (DIAG-TYPE . FACE).
The DIAG-TYPE is the return of `flymake--diag-type' and FACE is
the face to propertize the prefix text with.")
(defvar flymake-posframe--timer nil
"Variable to hold a timer in order to display the posframe.")
(defun flymake-posframe--check-position ()
"Update `flymake-posframe--last-position', returning t if there was no change."
(equal flymake-posframe--last-position
(setq flymake-posframe--last-position
(list (current-buffer) (buffer-modified-tick) (point)))))
(defun flymake-posframe--hide ()
"Hide the Flymake posframe.
Also remove the `flymake-posframe--hide-posframe-hooks'."
(posframe-hide flymake-posframe-buffer)
(dolist (hook flymake-posframe--hide-posframe-hooks)
(remove-hook hook #'flymake-posframe--hide t)))
(defun flymake-posframe--format-diag (diag)
"Propertize DIAG according to `flymake--diag-type'.
The argument DIAG is a `flymake--diag' object from Flymake."
(let* ((type (flymake--diag-type diag))
(prefix (alist-get type flymake-posframe--prefix-alist))
(face (alist-get type flymake-posframe--face-alist)))
(concat (propertize (eval prefix) 'face face) (flymake--diag-text diag))))
(defun flymake-posframe--current-frame ()
"Return current `posframe--frame' or nil if none."
(buffer-local-value
'posframe--frame
(get-buffer-create flymake-posframe-buffer)))
(defun flymake-posframe--show (contents)
"Show CONTENTS with `posframe-show'."
(let* ((fg (face-foreground 'flymake-posframe-face nil t))
(bg (face-background 'flymake-posframe-face nil t))
(frame (posframe-show
flymake-posframe-buffer
:internal-border-width 2
:left-fringe 1
:right-fringe 1
:position (point)
:foreground-color fg
:background-color bg
:string contents)))
(redirect-frame-focus frame (frame-parent frame))
(dolist (hook flymake-posframe--hide-posframe-hooks)
(add-hook hook #'flymake-posframe--hide nil t))))
(defun flymake-posframe--display-or-hide ()
"Display the Flymake posframe."
(when flymake-posframe--timer
(cancel-timer flymake-posframe--timer)
(setq flymake-posframe--timer nil))
(when flymake-mode
(if-let ((diag (get-char-property (point) 'flymake-diagnostic)))
(unless (and (eq flymake-posframe--last-diag
(setq flymake-posframe--last-diag diag))
(ignore-error 'wrong-type-argument
(frame-visible-p (flymake-posframe--current-frame))))
(flymake-posframe--check-position)
(setq flymake-posframe--timer
(run-at-time
(or flymake-posframe-idle-delay
(default-value 'flymake-posframe-idle-delay))
nil
(lambda ()
(flymake-posframe--show
(flymake-posframe--format-diag diag))))))
(flymake-posframe--hide))))
;;;###autoload
(define-minor-mode flymake-posframe-mode
"Minor mode for displaying Flymake diagnostics using `posframe'."
:lighter nil
:group flymake-posframe
(cond
(flymake-posframe-mode
(add-hook 'post-command-hook #'flymake-posframe--display-or-hide nil 'local))
(t
(remove-hook 'post-command-hook #'flymake-posframe--display-or-hide 'local))))
(provide 'flymake-posframe)
;;; flymake-posframe.el ends here
next prev parent reply other threads:[~2022-05-20 4:37 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-18 15:11 [NonGNU ELPA] New packages: popon, corfu-popup, flymake-popon Akib Azmain Turja
2022-05-18 18:44 ` Philip Kaludercic
2022-05-19 11:10 ` Akib Azmain Turja
2022-05-19 14:27 ` Philip Kaludercic
2022-05-19 18:00 ` Akib Azmain Turja
2022-05-19 18:26 ` João Pedro
2022-05-19 19:45 ` Akib Azmain Turja
2022-05-20 4:37 ` João Pedro [this message]
2022-05-20 4:40 ` João Pedro
2022-05-19 17:59 ` [NonGNU ELPA] New packages: popon, corfu-terminal, flymake-popon (Was: [NonGNU ELPA] New packages: popon, corfu-popup, flymake-popon) Akib Azmain Turja
2022-05-20 23:50 ` [NonGNU ELPA] New packages: popon, corfu-terminal, flymake-popon Philip Kaludercic
2022-05-21 7:33 ` Akib Azmain Turja
2022-05-21 8:05 ` Philip Kaludercic
2022-05-21 12:59 ` Akib Azmain Turja
2022-05-21 14:02 ` Philip Kaludercic
2022-05-22 11:17 ` Akib Azmain Turja
2022-05-22 11:31 ` Philip Kaludercic
2022-05-22 16:25 ` Philip Kaludercic
2022-05-23 7:12 ` Akib Azmain Turja
2022-05-23 8:11 ` Philip Kaludercic
2022-05-23 9:18 ` Akib Azmain Turja
2022-05-23 15:31 ` Philip Kaludercic
2022-05-20 22:31 ` [NonGNU ELPA] New packages: popon, corfu-popup, flymake-popon Richard Stallman
2022-05-21 7:36 ` Akib Azmain Turja
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87tu9k95va.fsf@gmail.com \
--to=jpedrodeamorim@gmail.com \
--cc=akib@disroot.org \
--cc=emacs-devel@gnu.org \
--cc=philipk@posteo.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).