all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Emanuel Berg <embe8573@student.uu.se>
To: help-gnu-emacs@gnu.org
Subject: Re: if and only if an Error message
Date: Sat, 19 Jul 2014 13:48:53 +0200	[thread overview]
Message-ID: <87lhrpd0wq.fsf@debian.uxu> (raw)
In-Reply-To: mailman.5660.1405749012.1147.help-gnu-emacs@gnu.org

Michael Heerdegen <michael_heerdegen@web.de> writes:

> It's not harmful.  But it's not a user option, so if
> you set its value, you should know what you are doing
> and how the flag is used internally.

If I had to know what I'm doing nothing would ever be
done. Even more so, if I know it, then why do it...

But put it this way: how do I find out a variable isn't
a user option?

> I would start trying something like this ...

Thank you!

Yes, check this out - 

(setq error-buffer-name "*Errors*")

;; inhibit the debugger -
;;   try this if nothing else: a wonderful thing to not
;;   have it hop out over half the screen for something
;;   that can be communicated in a few words
(setq debug-on-error nil)
(setq eval-expression-debug-on-error nil)

;; this does three things, see the comments
(defun say-and-log-error (data _ fun)
  (let*((error-str (format "%S in %S" data fun))
        (error-buffer (get-buffer-create error-buffer-name))
        (error-win (get-buffer-window error-buffer)) )
    (message error-str)                  ; echo the error message
    (with-current-buffer error-buffer
      (goto-char (point-max))
      (insert error-str "\n") )          ; log it
    (if error-win
        (with-selected-window error-win  ; move focus of error window
          (goto-char (point-max))        ; if available
          (recenter -1)) )))             ; (is there a better way?)

;; use it instead of the default one          
(setq command-error-function
      (lambda (&rest args)
        (apply #'say-and-log-error args)) )

;; show the error buffer        
(defun show-errors ()
  (interactive)
  (switch-to-buffer (get-buffer-create error-buffer-name))
  (goto-char (point-max)) ; the same situation: the last line of data
  (recenter -1) )         ; should be on the last window line
                          ; whenever possible

; test here:
; (message 'error-as-not-string)

-- 
underground experts united


  parent reply	other threads:[~2014-07-19 11:48 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-18 22:21 Emacs hangs with 100pc CPU during query-replace Thorsten Jolitz
2014-07-19  0:30 ` Michael Heerdegen
     [not found] ` <mailman.5641.1405730121.1147.help-gnu-emacs@gnu.org>
2014-07-19  1:16   ` Emanuel Berg
2014-07-19  1:36     ` Michael Heerdegen
2014-07-19  1:41       ` Michael Heerdegen
     [not found]       ` <mailman.5647.1405734322.1147.help-gnu-emacs@gnu.org>
2014-07-19  1:57         ` Emanuel Berg
2014-07-19  3:42           ` if and only if an Error message (was: Re: Emacs hangs with 100pc CPU during query-replace) Emanuel Berg
2014-07-19  4:00             ` if and only if an Error message Michael Heerdegen
     [not found]             ` <mailman.5654.1405742487.1147.help-gnu-emacs@gnu.org>
2014-07-19  4:10               ` Emanuel Berg
2014-07-19  4:38                 ` Michael Heerdegen
     [not found]                 ` <mailman.5655.1405744730.1147.help-gnu-emacs@gnu.org>
2014-07-19  4:49                   ` Emanuel Berg
2014-07-19  5:05                     ` Michael Heerdegen
2014-07-19  5:11                     ` Michael Heerdegen
     [not found]                     ` <mailman.5656.1405746345.1147.help-gnu-emacs@gnu.org>
2014-07-19  5:12                       ` Emanuel Berg
2014-07-19  5:49                         ` Michael Heerdegen
2014-07-19  6:01                           ` Michael Heerdegen
     [not found]                         ` <mailman.5660.1405749012.1147.help-gnu-emacs@gnu.org>
2014-07-19 11:48                           ` Emanuel Berg [this message]
2014-07-19 17:55                             ` Drew Adams
2014-07-20  1:42                             ` Michael Heerdegen
     [not found]                             ` <mailman.5724.1405820570.1147.help-gnu-emacs@gnu.org>
2014-07-20 21:38                               ` Emanuel Berg
2014-07-21  8:51                                 ` Michael Heerdegen
     [not found]                                 ` <mailman.5803.1405932728.1147.help-gnu-emacs@gnu.org>
2014-07-21 14:12                                   ` Emanuel Berg
2014-07-20 22:48                             ` avoiding global variables (was: Re: if and only if an Error message) Emanuel Berg
2014-07-21  5:01                               ` avoiding global variables Thien-Thi Nguyen
     [not found]                               ` <mailman.5793.1405918685.1147.help-gnu-emacs@gnu.org>
2014-07-21 14:10                                 ` Emanuel Berg
     [not found]     ` <mailman.5645.1405733824.1147.help-gnu-emacs@gnu.org>
2014-07-19  1:52       ` Emacs hangs with 100pc CPU during query-replace Emanuel Berg
2014-07-19  8:02     ` Thorsten Jolitz
2014-07-19  8:18       ` Eli Zaretskii
2014-07-19  8:27       ` Michael Heerdegen
2014-07-19  8:49         ` Thorsten Jolitz
2014-07-19  9:06         ` Thorsten Jolitz
2014-07-19 10:27           ` Eli Zaretskii
2014-07-19 11:29             ` Thorsten Jolitz
2014-07-19 10:33           ` Eli Zaretskii
2014-07-19 11:30             ` Thorsten Jolitz
     [not found]         ` <<871tth1zw9.fsf@gmail.com>
     [not found]           ` <<83iomt63uf.fsf@gnu.org>
2014-07-19 17:51             ` Drew Adams

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87lhrpd0wq.fsf@debian.uxu \
    --to=embe8573@student.uu.se \
    --cc=help-gnu-emacs@gnu.org \
    /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 external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.