unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Messages in el functions & the Mini-Buffer
@ 2020-10-28 10:26 Christopher Dimech
  2020-10-28 10:44 ` tomas
  2020-10-28 12:29 ` Emanuel Berg via Users list for the GNU Emacs text editor
  0 siblings, 2 replies; 6+ messages in thread
From: Christopher Dimech @ 2020-10-28 10:26 UTC (permalink / raw)
  To: Help Gnu Emacs


When I introduce (message "Fuckup") in an Elisp function, does it always use the
mini-buffer?  Is there a command to output in a window buffer like when I use
M-x describe function?



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

* Re: Messages in el functions & the Mini-Buffer
  2020-10-28 10:26 Messages in el functions & the Mini-Buffer Christopher Dimech
@ 2020-10-28 10:44 ` tomas
  2020-10-28 10:53   ` Christopher Dimech
  2020-10-28 12:29 ` Emanuel Berg via Users list for the GNU Emacs text editor
  1 sibling, 1 reply; 6+ messages in thread
From: tomas @ 2020-10-28 10:44 UTC (permalink / raw)
  To: help-gnu-emacs

[-- Attachment #1: Type: text/plain, Size: 464 bytes --]

On Wed, Oct 28, 2020 at 11:26:31AM +0100, Christopher Dimech wrote:
> 
> When I introduce (message "Fuckup") in an Elisp function, does it always use the
> mini-buffer?  Is there a command to output in a window buffer like when I use
> M-x describe function?

It (usually) goes to a buffer: this buffer is called *Messages*. You can switch
to it like to every other buffer, e.g. with C-x b<RET>*Messages*<RET>

What is a "window buffer"?

Cheers
 - t

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

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

* Re: Messages in el functions & the Mini-Buffer
  2020-10-28 10:44 ` tomas
@ 2020-10-28 10:53   ` Christopher Dimech
  2020-10-28 11:06     ` Joost Kremers
  0 siblings, 1 reply; 6+ messages in thread
From: Christopher Dimech @ 2020-10-28 10:53 UTC (permalink / raw)
  To: tomas; +Cc: help-gnu-emacs

Very good. Have been trying to write (message "%end-of-fuckup")
and a problem crops up when trying to display the '%' symbol.



> Sent: Wednesday, October 28, 2020 at 11:44 AM
> From: tomas@tuxteam.de
> To: help-gnu-emacs@gnu.org
> Subject: Re: Messages in el functions & the Mini-Buffer
>
> On Wed, Oct 28, 2020 at 11:26:31AM +0100, Christopher Dimech wrote:
> >
> > When I introduce (message "Fuckup") in an Elisp function, does it always use the
> > mini-buffer?  Is there a command to output in a window buffer like when I use
> > M-x describe function?
>
> It (usually) goes to a buffer: this buffer is called *Messages*. You can switch
> to it like to every other buffer, e.g. with C-x b<RET>*Messages*<RET>
>
> What is a "window buffer"?
>
> Cheers
>  - t
>



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

* Re: Messages in el functions & the Mini-Buffer
  2020-10-28 10:53   ` Christopher Dimech
@ 2020-10-28 11:06     ` Joost Kremers
  2020-10-28 12:25       ` Michael Heerdegen
  0 siblings, 1 reply; 6+ messages in thread
From: Joost Kremers @ 2020-10-28 11:06 UTC (permalink / raw)
  To: help-gnu-emacs


On Wed, Oct 28 2020, Christopher Dimech wrote:
> Very good. Have been trying to write (message "%end-of-fuckup")
> and a problem crops up when trying to display the '%' symbol.

That's because the string passed to `message` is a format string, as with the
function `format`. See the documentation strings of `message` and `format` for
details.

>> > When I introduce (message "Fuckup") in an Elisp function, does it always use the
>> > mini-buffer?  Is there a command to output in a window buffer like when I use
>> > M-x describe function?

You can use the macro `with-help-window` to get an effect similar to `describe-function`. 

-- 
Joost Kremers
Life has its moments



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

* Re: Messages in el functions & the Mini-Buffer
  2020-10-28 11:06     ` Joost Kremers
@ 2020-10-28 12:25       ` Michael Heerdegen
  0 siblings, 0 replies; 6+ messages in thread
From: Michael Heerdegen @ 2020-10-28 12:25 UTC (permalink / raw)
  To: help-gnu-emacs

Joost Kremers <joostkremers@fastmail.fm> writes:

> You can use the macro `with-help-window` to get an effect similar to
> `describe-function`.

Another alternative: `display-message-or-buffer'.

Michael.




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

* Re: Messages in el functions & the Mini-Buffer
  2020-10-28 10:26 Messages in el functions & the Mini-Buffer Christopher Dimech
  2020-10-28 10:44 ` tomas
@ 2020-10-28 12:29 ` Emanuel Berg via Users list for the GNU Emacs text editor
  1 sibling, 0 replies; 6+ messages in thread
From: Emanuel Berg via Users list for the GNU Emacs text editor @ 2020-10-28 12:29 UTC (permalink / raw)
  To: help-gnu-emacs

Christopher Dimech wrote:

> When I introduce (message "Fuckup")

...

> in an Elisp function, does it always use the mini-buffer? Is there
> a command to output in a window buffer like when I use M-x
> describe function?

You can write such a general command, by studying this function:

(defun print-roll-outs (chainrings sprockets bsd tire)
  (let ((out-buffer (get-buffer-create "*gears*")))
    (with-current-buffer out-buffer
      (goto-char (point-max))
      (print-intro-data chainrings sprockets bsd tire)
      (let ((ros (all-roll-outs chainrings sprockets bsd tire)))
        (cl-loop for ro in ros do
                 (let ((c (   car   ro))
                       (s (   cadr  ro))
                       (r (cl-caddr ro)))
                   (insert (format "% 9d% 14d% 15.0f\n" c s r)) ))))
    (pop-to-buffer out-buffer) ))

In particular, `get-buffer-create', `with-current-buffer', `insert',
and `pop-to-buffer'.

Half source:

  https://dataswamp.org/~incal/emacs-init/bike.el

-- 
underground experts united
http://user.it.uu.se/~embe8573
https://dataswamp.org/~incal




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

end of thread, other threads:[~2020-10-28 12:29 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-10-28 10:26 Messages in el functions & the Mini-Buffer Christopher Dimech
2020-10-28 10:44 ` tomas
2020-10-28 10:53   ` Christopher Dimech
2020-10-28 11:06     ` Joost Kremers
2020-10-28 12:25       ` Michael Heerdegen
2020-10-28 12:29 ` Emanuel Berg via Users list for the GNU Emacs text editor

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