all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* how to hide emacs 26 warnings buffer ?
@ 2018-04-23  2:54 Zhang Jun
  2018-04-23 15:09 ` Eli Zaretskii
  0 siblings, 1 reply; 5+ messages in thread
From: Zhang Jun @ 2018-04-23  2:54 UTC (permalink / raw)
  To: help-gnu-emacs

I've switched to emacs 26.0.91 from 25,

when I editing a file, emacs will create '#file# backup file,
but I don't have write permission to the directory,
emacs26 will display a *warnings* buffer,
I don't like this buffer, prefer the warning message in mini-buffer.

how can I set it ?

thanks!


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

* Re: how to hide emacs 26 warnings buffer ?
       [not found] <mailman.12860.1524452099.27995.help-gnu-emacs@gnu.org>
@ 2018-04-23  3:53 ` Emanuel Berg
  2018-04-24  5:59   ` Zhang Jun
       [not found]   ` <mailman.12920.1524549581.27995.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 5+ messages in thread
From: Emanuel Berg @ 2018-04-23  3:53 UTC (permalink / raw)
  To: help-gnu-emacs

Zhang Jun wrote:

> I've switched to emacs 26.0.91 from 25,
>
> when I editing a file, emacs will create
> '#file# backup file, but I don't have write
> permission to the directory, emacs26 will
> display a *warnings* buffer, I don't like
> this buffer, prefer the warning message in
> mini-buffer.

Indeed: when you look into the tiger's eyes,
you see ONLY your own feelings!

;; This file: http://user.it.uu.se/~embe8573/emacs-init/error.el

(require 'cl-lib)

;; inhibit the debugger --
;; so not to have the debugger hop out
;; over half the screen for something that can be
;; communicated in 2-3 few words in the echo area
(setq debug-on-error                 nil)
(setq eval-expression-debug-on-error nil)

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

(defvar error-buffer-name "*Errors*" "Errors log buffer.")

(defun say-and-log-error (data _ fun)
  "This error function communicates the errors in the echo area.
It does so by means of a one-liner as to avoid being disruptive
(while still offering condensed feedback, which often is enough).
DATA is the error; FUN is where it occurred.
The errors are logged in the buffer `error-buffer-name'.
To list them, use `errors'.
To use this function, set `command-error-function' to:
\(lambda \(&rest args\) \(apply #'say-and-log-error args\)"
  (if (not (member (car data) debug-ignored-errors))
      (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 "%s" error-str)           ; echo the error message
        (with-current-buffer error-buffer
          (goto-char (point-max))
          (insert error-str "\n") )        ; log it
        (discard-input) )))

(setq command-error-function
      (lambda (&rest args)
        (apply #'say-and-log-error args) ))

(defun errors ()
  "Visit the errors log buffer, `error-buffer-name'.
See `say-and-log-error' for more on this."
  (interactive)
  (switch-to-buffer (get-buffer-create error-buffer-name))
  (goto-char (point-max))
  (recenter -1) )

;; (/ 1 0)

(provide 'error)

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


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

* Re: how to hide emacs 26 warnings buffer ?
  2018-04-23  2:54 Zhang Jun
@ 2018-04-23 15:09 ` Eli Zaretskii
  0 siblings, 0 replies; 5+ messages in thread
From: Eli Zaretskii @ 2018-04-23 15:09 UTC (permalink / raw)
  To: help-gnu-emacs

> From: Zhang Jun <gb2313@gmail.com>
> Date: Mon, 23 Apr 2018 10:54:55 +0800
> 
> I've switched to emacs 26.0.91 from 25,
> 
> when I editing a file, emacs will create '#file# backup file,
> but I don't have write permission to the directory,
> emacs26 will display a *warnings* buffer,
> I don't like this buffer, prefer the warning message in mini-buffer.
> 
> how can I set it ?

You can set up Emacs to make backup files in a special directory.  See
the documentation of the variable backup-directory-alist.



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

* Re: how to hide emacs 26 warnings buffer ?
  2018-04-23  3:53 ` how to hide emacs 26 warnings buffer ? Emanuel Berg
@ 2018-04-24  5:59   ` Zhang Jun
       [not found]   ` <mailman.12920.1524549581.27995.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 5+ messages in thread
From: Zhang Jun @ 2018-04-24  5:59 UTC (permalink / raw)
  To: help-gnu-emacs

On Mon, Apr 23, 2018 at 11:53 AM, Emanuel Berg <moasen@zoho.com> wrote:

> Zhang Jun wrote:
>
> > I've switched to emacs 26.0.91 from 25,
> >
> > when I editing a file, emacs will create
> > '#file# backup file, but I don't have write
> > permission to the directory, emacs26 will
> > display a *warnings* buffer, I don't like
> > this buffer, prefer the warning message in
> > mini-buffer.
>
> Indeed: when you look into the tiger's eyes,
> you see ONLY your own feelings!
>
> ;; This file: http://user.it.uu.se/~embe8573/emacs-init/error.el
>
> (require 'cl-lib)
>
> ;; inhibit the debugger --
> ;; so not to have the debugger hop out
> ;; over half the screen for something that can be
> ;; communicated in 2-3 few words in the echo area
> (setq debug-on-error                 nil)
> (setq eval-expression-debug-on-error nil)
>
> ;; ignore a couple of common "errors"
> (setq debug-ignored-errors
>       '(
>         beginning-of-buffer
>         beginning-of-line
>         buffer-read-only
>         end-of-buffer
>         end-of-file
>         end-of-line
>         file-supersession
>         text-read-only
>         quit
>         ))
>
> (defvar error-buffer-name "*Errors*" "Errors log buffer.")
>
> (defun say-and-log-error (data _ fun)
>   "This error function communicates the errors in the echo area.
> It does so by means of a one-liner as to avoid being disruptive
> (while still offering condensed feedback, which often is enough).
> DATA is the error; FUN is where it occurred.
> The errors are logged in the buffer `error-buffer-name'.
> To list them, use `errors'.
> To use this function, set `command-error-function' to:
> \(lambda \(&rest args\) \(apply #'say-and-log-error args\)"
>   (if (not (member (car data) debug-ignored-errors))
>       (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 "%s" error-str)           ; echo the error message
>         (with-current-buffer error-buffer
>           (goto-char (point-max))
>           (insert error-str "\n") )        ; log it
>         (discard-input) )))
>
> (setq command-error-function
>       (lambda (&rest args)
>         (apply #'say-and-log-error args) ))
>
> (defun errors ()
>   "Visit the errors log buffer, `error-buffer-name'.
> See `say-and-log-error' for more on this."
>   (interactive)
>   (switch-to-buffer (get-buffer-create error-buffer-name))
>   (goto-char (point-max))
>   (recenter -1) )
>
> ;; (/ 1 0)
>
> (provide 'error)
>
> --
> underground experts united
> http://user.it.uu.se/~embe8573
>


thanks, but after install this error.el, it still display the buffer,
I checked some elisp doc and use 'advice-add' :before-util to display
"auto-save" warnings in mini-buffer.


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

* Re: how to hide emacs 26 warnings buffer ?
       [not found]   ` <mailman.12920.1524549581.27995.help-gnu-emacs@gnu.org>
@ 2018-04-24  6:18     ` Emanuel Berg
  0 siblings, 0 replies; 5+ messages in thread
From: Emanuel Berg @ 2018-04-24  6:18 UTC (permalink / raw)
  To: help-gnu-emacs

Zhang Jun wrote:

> thanks, but after install this error.el, it
> still display the buffer

Right, it is a warning, not an error!

But you can still use the same principle only
with a warning wrapper instead. Overload the
function. Check for unwanted messages.
On a hit, do nothing. Else, precede.

Stay tuned, I'll post some code later God
willing...

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


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

end of thread, other threads:[~2018-04-24  6:18 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <mailman.12860.1524452099.27995.help-gnu-emacs@gnu.org>
2018-04-23  3:53 ` how to hide emacs 26 warnings buffer ? Emanuel Berg
2018-04-24  5:59   ` Zhang Jun
     [not found]   ` <mailman.12920.1524549581.27995.help-gnu-emacs@gnu.org>
2018-04-24  6:18     ` Emanuel Berg
2018-04-23  2:54 Zhang Jun
2018-04-23 15:09 ` Eli Zaretskii

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.