unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* flymake-display-err-menu-for-current-line does not work under -nw
@ 2007-12-04 22:30 Ævar Arnfjörð Bjarmason
  2007-12-04 23:12 ` Lennart Borgman (gmail)
  0 siblings, 1 reply; 5+ messages in thread
From: Ævar Arnfjörð Bjarmason @ 2007-12-04 22:30 UTC (permalink / raw)
  To: emacs-devel


flymake-display-err-menu-for-current-line does not work excpet under
X. Here's one implementation for text mode that I use which displays the
errors/warnings in the echo area instead of opening a menu:

(defun flymake-display-err-message-for-current-line ()
  "Display a message with errors/warnings for current line if it
has errors and/or warnings."
  (interactive)
  (let* ((line-no             (flymake-current-line-no))
         (line-err-info-list  (nth 0 (flymake-find-err-info flymake-err-info line-no)))
         (menu-data           (flymake-make-err-menu-data line-no line-err-info-list)))
    (if menu-data
        (let ((messages))
          (push (concat (car menu-data) ":") messages)
          (dolist (error-or-warning (cadr menu-data))
            (push (car error-or-warning) messages))
          (message "%s" (mapconcat #'identity (reverse messages) "\n"))))))

I want to get this or something like it into Emacs pending comments on
whether this implementation is even a good idea. Should it use
(message)? Would it be better to use a idle timer like eldoc-mode does?
Something completely different?

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: flymake-display-err-menu-for-current-line does not work under -nw
  2007-12-04 22:30 flymake-display-err-menu-for-current-line does not work under -nw Ævar Arnfjörð Bjarmason
@ 2007-12-04 23:12 ` Lennart Borgman (gmail)
  2007-12-04 23:40   ` Ævar Arnfjörð Bjarmason
  0 siblings, 1 reply; 5+ messages in thread
From: Lennart Borgman (gmail) @ 2007-12-04 23:12 UTC (permalink / raw)
  To: Ævar Arnfjörð Bjarmason; +Cc: emacs-devel

Ævar Arnfjörð Bjarmason wrote:
> flymake-display-err-menu-for-current-line does not work excpet under
> X. Here's one implementation for text mode that I use which displays the
> errors/warnings in the echo area instead of opening a menu:
> 
> (defun flymake-display-err-message-for-current-line ()
>   "Display a message with errors/warnings for current line if it
> has errors and/or warnings."
>   (interactive)
>   (let* ((line-no             (flymake-current-line-no))
>          (line-err-info-list  (nth 0 (flymake-find-err-info flymake-err-info line-no)))
>          (menu-data           (flymake-make-err-menu-data line-no line-err-info-list)))
>     (if menu-data
>         (let ((messages))
>           (push (concat (car menu-data) ":") messages)
>           (dolist (error-or-warning (cadr menu-data))
>             (push (car error-or-warning) messages))
>           (message "%s" (mapconcat #'identity (reverse messages) "\n"))))))
> 
> I want to get this or something like it into Emacs pending comments on
> whether this implementation is even a good idea. Should it use
> (message)? Would it be better to use a idle timer like eldoc-mode does?
> Something completely different?


Another possibility is to add the error message to the after-text or 
before-text of the overlay that flymake put on the line. However I do 
not think the text should be added to the overlay until the user 
requests it, otherwise the lines in the buffer will be jumping in an 
uncontrolled way.

Eh, but adding it to the overlay will mean that the buffer lines jumps 
afterward when flymake is removing the overlay.

Maybe it is better to check use-dialog-box?

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: flymake-display-err-menu-for-current-line does not work under -nw
  2007-12-04 23:12 ` Lennart Borgman (gmail)
@ 2007-12-04 23:40   ` Ævar Arnfjörð Bjarmason
  2007-12-04 23:51     ` Lennart Borgman (gmail)
  0 siblings, 1 reply; 5+ messages in thread
From: Ævar Arnfjörð Bjarmason @ 2007-12-04 23:40 UTC (permalink / raw)
  To: Lennart Borgman (gmail); +Cc: emacs-devel

"Lennart Borgman (gmail)" <lennart.borgman@gmail.com> writes:

> Another possibility is to add the error message to the after-text or
> before-text of the overlay that flymake put on the line. However I do
> not think the text should be added to the overlay until the user
> requests it, otherwise the lines in the buffer will be jumping in an
> uncontrolled way.
>
> Eh, but adding it to the overlay will mean that the buffer lines jumps
> afterward when flymake is removing the overlay.

I'll have to check out doing this via overlays. I don't find any mention
of after-text or before-text in the Emacs sources however.

> Maybe it is better to check use-dialog-box?

I'm sorry but I don't understand, to do what? Check if we should use
flymake-display-err-menu-for-current-line?

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: flymake-display-err-menu-for-current-line does not work under -nw
  2007-12-04 23:40   ` Ævar Arnfjörð Bjarmason
@ 2007-12-04 23:51     ` Lennart Borgman (gmail)
  2007-12-05  1:17       ` Ævar Arnfjörð Bjarmason
  0 siblings, 1 reply; 5+ messages in thread
From: Lennart Borgman (gmail) @ 2007-12-04 23:51 UTC (permalink / raw)
  To: Ævar Arnfjörð Bjarmason; +Cc: emacs-devel

Ævar Arnfjörð Bjarmason wrote:
> "Lennart Borgman (gmail)" <lennart.borgman@gmail.com> writes:
> 
>> Another possibility is to add the error message to the after-text or
>> before-text of the overlay that flymake put on the line. However I do
>> not think the text should be added to the overlay until the user
>> requests it, otherwise the lines in the buffer will be jumping in an
>> uncontrolled way.
>>
>> Eh, but adding it to the overlay will mean that the buffer lines jumps
>> afterward when flymake is removing the overlay.
> 
> I'll have to check out doing this via overlays. I don't find any mention
> of after-text or before-text in the Emacs sources however.

Sorry, it should be 'after-string and 'before-string (but I do not think 
using them here will be very good).

   (info "(elips) Overlay Properties")

>> Maybe it is better to check use-dialog-box?
> 
> I'm sorry but I don't understand, to do what? Check if we should use
> flymake-display-err-menu-for-current-line?

I thought you said that popup menus are not supported always. I believe 
use-dialog-box should be nil if they are not (or if the user does not 
want popup messages).

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: flymake-display-err-menu-for-current-line does not work under -nw
  2007-12-04 23:51     ` Lennart Borgman (gmail)
@ 2007-12-05  1:17       ` Ævar Arnfjörð Bjarmason
  0 siblings, 0 replies; 5+ messages in thread
From: Ævar Arnfjörð Bjarmason @ 2007-12-05  1:17 UTC (permalink / raw)
  To: Lennart Borgman (gmail); +Cc: emacs-devel

"Lennart Borgman (gmail)" <lennart.borgman@gmail.com> writes:

>> I'll have to check out doing this via overlays. I don't find any mention
>> of after-text or before-text in the Emacs sources however.
>
> Sorry, it should be 'after-string and 'before-string (but I do not
> think using them here will be very good).
>
>   (info "(elisp) Overlay Properties")

Thanks, I'll check out overlays.

>>> Maybe it is better to check use-dialog-box?
>>
>> I'm sorry but I don't understand, to do what? Check if we should use
>> flymake-display-err-menu-for-current-line?
>
> I thought you said that popup menus are not supported always. I
> believe use-dialog-box should be nil if they are not (or if the user
> does not want popup messages).

They're actually (x-popup-menu)'s that are not affected by the
use-dialog-box variable. It only applies to (message-or-box) and
(y-or-n-p).

I don't think (message-or-box) can be used here since the current
implementation presents a selector. Although I haven't seen it do
anything useful myself when using flymake with C and Perl.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2007-12-05  1:17 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-12-04 22:30 flymake-display-err-menu-for-current-line does not work under -nw Ævar Arnfjörð Bjarmason
2007-12-04 23:12 ` Lennart Borgman (gmail)
2007-12-04 23:40   ` Ævar Arnfjörð Bjarmason
2007-12-04 23:51     ` Lennart Borgman (gmail)
2007-12-05  1:17       ` Ævar Arnfjörð Bjarmason

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).