unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Suppress (pop kill-ring) from *Messages*
@ 2015-11-01 19:53 Tim Johnson
  2015-11-01 21:19 ` Random832
                   ` (4 more replies)
  0 siblings, 5 replies; 9+ messages in thread
From: Tim Johnson @ 2015-11-01 19:53 UTC (permalink / raw)
  To: Emacs

I often prefer to have an item popped off of the kill ring
programmatically/automatically.

If I invoke (pop kill-ring) from some elisp code, the top item shows in in *Messages*

If I invoke browse-kill-ring and delete the top item, it is done
silently.

How can I suppress the recording of the item in messages?

-- 
Tim 
http://www.akwebsoft.com, http://www.tj49.com



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

* Re: Suppress (pop kill-ring) from *Messages*
  2015-11-01 19:53 Suppress (pop kill-ring) from *Messages* Tim Johnson
@ 2015-11-01 21:19 ` Random832
  2015-11-01 21:19 ` Random832
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 9+ messages in thread
From: Random832 @ 2015-11-01 21:19 UTC (permalink / raw)
  To: help-gnu-emacs

Tim Johnson <tim@akwebsoft.com> writes:
> If I invoke (pop kill-ring) from some elisp code, the top item shows
> in in *Messages*

> How can I suppress the recording of the item in messages?

pop _returns_ the popped object. It's printing as a message because, I
suspect, you're executing it with C-x C-e or M-:. You can suppress this
by having it return nil, but it shouldn't be an issue when the code is
being run normally (being called a function you've put in a key binding,
or a hook etc) rather than through C-x C-e or M-:.




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

* Re: Suppress (pop kill-ring) from *Messages*
  2015-11-01 19:53 Suppress (pop kill-ring) from *Messages* Tim Johnson
  2015-11-01 21:19 ` Random832
@ 2015-11-01 21:19 ` Random832
  2015-11-01 21:33 ` Marcin Borkowski
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 9+ messages in thread
From: Random832 @ 2015-11-01 21:19 UTC (permalink / raw)
  To: help-gnu-emacs

Tim Johnson <tim@akwebsoft.com> writes:
> If I invoke (pop kill-ring) from some elisp code, the top item shows
> in in *Messages*

> How can I suppress the recording of the item in messages?

pop _returns_ the popped object. It's printing as a message because, I
suspect, you're executing it with C-x C-e or M-:. You can suppress this
by having it return nil, but it shouldn't be an issue when the code is
being run normally (being called a function you've put in a key binding,
or a hook etc) rather than through C-x C-e or M-:.




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

* Re: Suppress (pop kill-ring) from *Messages*
  2015-11-01 19:53 Suppress (pop kill-ring) from *Messages* Tim Johnson
  2015-11-01 21:19 ` Random832
  2015-11-01 21:19 ` Random832
@ 2015-11-01 21:33 ` Marcin Borkowski
  2015-11-01 21:55   ` Tim Johnson
  2015-11-02  0:41 ` Emanuel Berg
  2015-11-02  1:05 ` restrictive/discrete messages log (was: Re: Suppress (pop kill-ring) from *Messages*) Emanuel Berg
  4 siblings, 1 reply; 9+ messages in thread
From: Marcin Borkowski @ 2015-11-01 21:33 UTC (permalink / raw)
  To: Tim Johnson; +Cc: Emacs


On 2015-11-01, at 20:53, Tim Johnson <tim@akwebsoft.com> wrote:

> I often prefer to have an item popped off of the kill ring
> programmatically/automatically.
>
> If I invoke (pop kill-ring) from some elisp code, the top item shows in in *Messages*

I would guess that what you are doing is M-: (pop kill-ring) or
something similar.  Since `pop' returns the popped value, it is then
shown.

On the other hand, this:

(defun pop-from-kill-ring ()
  "Pop an item from kill-ring and discard it."
  (interactive)
  (pop kill-ring))

does not show anything when invoked via M-x pop-from-kill-ring, and
shows the discarded value again when invoked via
M-: (pop-from-kill-ring)

> If I invoke browse-kill-ring and delete the top item, it is done
> silently.
>
> How can I suppress the recording of the item in messages?

Hth,

-- 
Marcin Borkowski
http://octd.wmi.amu.edu.pl/en/Marcin_Borkowski
Faculty of Mathematics and Computer Science
Adam Mickiewicz University



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

* Re: Suppress (pop kill-ring) from *Messages*
  2015-11-01 21:33 ` Marcin Borkowski
@ 2015-11-01 21:55   ` Tim Johnson
  0 siblings, 0 replies; 9+ messages in thread
From: Tim Johnson @ 2015-11-01 21:55 UTC (permalink / raw)
  To: Emacs

* Marcin Borkowski <mbork@mbork.pl> [151101 12:39]:
> 
> On 2015-11-01, at 20:53, Tim Johnson <tim@akwebsoft.com> wrote:
> 
> > I often prefer to have an item popped off of the kill ring
> > programmatically/automatically.
> >
> > If I invoke (pop kill-ring) from some elisp code, the top item shows in in *Messages*
> 
> I would guess that what you are doing is M-: (pop kill-ring) or
> something similar.  Since `pop' returns the popped value, it is then
> shown.
> 
> On the other hand, this:
> 
> (defun pop-from-kill-ring ()
>   "Pop an item from kill-ring and discard it."
>   (interactive)
>   (pop kill-ring))
> 
> does not show anything when invoked via M-x pop-from-kill-ring, and
> shows the discarded value again when invoked via
> M-: (pop-from-kill-ring)
  Yes! And this is very handy to know for other applications.
  Thanks very much
-- 
Tim 
http://www.akwebsoft.com, http://www.tj49.com



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

* Re: Suppress (pop kill-ring) from *Messages*
  2015-11-01 19:53 Suppress (pop kill-ring) from *Messages* Tim Johnson
                   ` (2 preceding siblings ...)
  2015-11-01 21:33 ` Marcin Borkowski
@ 2015-11-02  0:41 ` Emanuel Berg
  2015-11-02 16:23   ` Tim Johnson
  2015-11-02  1:05 ` restrictive/discrete messages log (was: Re: Suppress (pop kill-ring) from *Messages*) Emanuel Berg
  4 siblings, 1 reply; 9+ messages in thread
From: Emanuel Berg @ 2015-11-02  0:41 UTC (permalink / raw)
  To: help-gnu-emacs

Tim Johnson <tim@akwebsoft.com> writes:

> I often prefer to have an item popped off of the
> kill ring programmatically/automatically.
>
> If I invoke (pop kill-ring) from some elisp code,
> the top item shows in in *Messages*
>
> If I invoke browse-kill-ring and delete the top
> item, it is done silently.
>
> How can I suppress the recording of the item
> in messages?

Perhaps (?) this experimentation is of interest to you:

(defun test-suppress-messages ()
  (interactive)
  (let ((log-size message-log-max)) ; (setq message-log-max 1000)
    (setq message-log-max nil)
    (message "No buffer, not last - suppressed!")
    (setq message-log-max log-size)
    (message "Buffer, so this message is logged.")
    (message "Buffer and last, so this message is echoed as well as logged.") ))
;; (test-suppress-messages)

-- 
underground experts united
http://user.it.uu.se/~embe8573




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

* restrictive/discrete messages log (was: Re: Suppress (pop kill-ring) from *Messages*)
  2015-11-01 19:53 Suppress (pop kill-ring) from *Messages* Tim Johnson
                   ` (3 preceding siblings ...)
  2015-11-02  0:41 ` Emanuel Berg
@ 2015-11-02  1:05 ` Emanuel Berg
  4 siblings, 0 replies; 9+ messages in thread
From: Emanuel Berg @ 2015-11-02  1:05 UTC (permalink / raw)
  To: help-gnu-emacs

Tim Johnson <tim@akwebsoft.com> writes:

> How can I suppress the recording of the item
> in messages?

How can one do this in general?

For the debugger, there is, for example

    ;; ignore a couple of common "errors"
    (setq debug-ignored-errors
          '(quit
            beginning-of-line    end-of-line
            beginning-of-buffer  end-of-buffer
            end-of-file
            buffer-read-only
            file-supersession) )

but for messages? The only thing I can think of is
the command that brings up the messages buffer.
Then you can do some filtering, like this:

    (defun switch-to-filtered-messages-buffer ()
      (interactive)
      (switch-to-buffer (messages-buffer))
      (let ((inhibit-read-only t))
        (goto-char 0)
        (while (re-search-forward "Mark set\n" nil t) ; no BOUND; NOERROR
          (replace-match "") ))
      (goto-char (point-max)) )

However, it doesn't work if the messages buffer is
visible already and the user doesn't have to invoke
a command to bring it up.

You see? Yet another advantage for the two-pane, tty
solution where buffers constantly have to be "brought
up"! :)

-- 
underground experts united
http://user.it.uu.se/~embe8573




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

* Re: Suppress (pop kill-ring) from *Messages*
  2015-11-02  0:41 ` Emanuel Berg
@ 2015-11-02 16:23   ` Tim Johnson
  2015-11-03  2:46     ` Emanuel Berg
  0 siblings, 1 reply; 9+ messages in thread
From: Tim Johnson @ 2015-11-02 16:23 UTC (permalink / raw)
  To: help-gnu-emacs

* Emanuel Berg <embe8573@student.uu.se> [151101 15:42]:
> >
> > How can I suppress the recording of the item
> > in messages?
> 
> Perhaps (?) this experimentation is of interest to you:

  Indeed, is of great interest. 

> (defun test-suppress-messages ()
>   (interactive)
>   (let ((log-size message-log-max)) ; (setq message-log-max 1000)
>     (setq message-log-max nil)
>     (message "No buffer, not last - suppressed!")
>     (setq message-log-max log-size)
>     (message "Buffer, so this message is logged.")
>     (message "Buffer and last, so this message is echoed as well as logged.") ))
> ;; (test-suppress-messages)
 
   Thank you, Emanuel. I need to take some time to grok this and
   your other email. Very interesting information that could aid me
   in other issues.

-- 
Tim 
http://www.akwebsoft.com, http://www.tj49.com



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

* Re: Suppress (pop kill-ring) from *Messages*
  2015-11-02 16:23   ` Tim Johnson
@ 2015-11-03  2:46     ` Emanuel Berg
  0 siblings, 0 replies; 9+ messages in thread
From: Emanuel Berg @ 2015-11-03  2:46 UTC (permalink / raw)
  To: help-gnu-emacs

Tim Johnson <tim@akwebsoft.com> writes:

> Thank you, Emanuel. I need to take some time to grok
> this and your other email. Very interesting
> information that could aid me in other issues.

Yeah, bear in mind tho that method inhibits *all*
messages. I don't think anyone wants that. But it is
a start :)

There isn't a lot of messages stuff what I can see.
Most hits are not the *Messages* buffer but comes with
Gnus, Rmail, ERC, and even compilation, garbage
collection, and so on.

Perhaps you should have a look at the [M]ELPAs and the
EmacsWiki if other people before you thought to much
logging was done.

-- 
underground experts united
http://user.it.uu.se/~embe8573




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

end of thread, other threads:[~2015-11-03  2:46 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-11-01 19:53 Suppress (pop kill-ring) from *Messages* Tim Johnson
2015-11-01 21:19 ` Random832
2015-11-01 21:19 ` Random832
2015-11-01 21:33 ` Marcin Borkowski
2015-11-01 21:55   ` Tim Johnson
2015-11-02  0:41 ` Emanuel Berg
2015-11-02 16:23   ` Tim Johnson
2015-11-03  2:46     ` Emanuel Berg
2015-11-02  1:05 ` restrictive/discrete messages log (was: Re: Suppress (pop kill-ring) from *Messages*) Emanuel Berg

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