From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Christopher Wellons Newsgroups: gmane.emacs.devel Subject: [PATCH] Add Viper bell to debug-ignored-errors Date: Sat, 9 Mar 2019 08:36:39 -0500 Message-ID: <20190309133639.zcpnckygjmkniqge@nullprogram.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="12916"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: NeoMutt/20170113 (1.7.2) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Mar 09 15:01:25 2019 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1h2cXU-0003D7-MT for ged-emacs-devel@m.gmane.org; Sat, 09 Mar 2019 15:01:24 +0100 Original-Received: from localhost ([127.0.0.1]:59407 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h2cXT-0002lZ-Fa for ged-emacs-devel@m.gmane.org; Sat, 09 Mar 2019 09:01:23 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:42540) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h2c9g-0007Uw-1q for emacs-devel@gnu.org; Sat, 09 Mar 2019 08:36:49 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h2c9e-0002x4-N5 for emacs-devel@gnu.org; Sat, 09 Mar 2019 08:36:48 -0500 Original-Received: from mail.nullprogram.com ([192.241.191.137]:35866) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1h2c9e-0002sx-Gv for emacs-devel@gnu.org; Sat, 09 Mar 2019 08:36:46 -0500 Original-Received: from nullprogram.com (localhost [127.0.0.1]) by mail.nullprogram.com (Postfix) with ESMTPS id BFA72C5B5B for ; Sat, 9 Mar 2019 08:36:40 -0500 (EST) Content-Disposition: inline X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 192.241.191.137 X-Mailman-Approved-At: Sat, 09 Mar 2019 09:00:41 -0500 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:233966 Archived-At: Using Viper and toggle-debug-on-error at the same time is irritating because the debugger is activated on each "Viper bell" signal. This is solved by adding the signal to debug-ignored-errors. Since Viper's other common error messages are given a defconst, this patch replaces all instances of "Viper bell" with a new defconst, viper-ViperBell, and that defconst is also used for debug-ignored-errors. diff --git a/lisp/emulation/viper-cmd.el b/lisp/emulation/viper-cmd.el index f041f25ae9..2784fe81c0 100644 --- a/lisp/emulation/viper-cmd.el +++ b/lisp/emulation/viper-cmd.el @@ -1124,7 +1124,7 @@ viper-prefix-arg-com ;; it is an error. (progn ;; new com is (CHAR . OLDCOM) - (if (viper-memq-char char '(?# ?\")) (error "Viper bell")) + (if (viper-memq-char char '(?# ?\")) (error viper-ViperBell)) (setq com (cons char com)) (setq cont nil)) ;; If com is nil we set com as char, and read more. Again, if char is @@ -1143,7 +1143,7 @@ viper-prefix-arg-com (let ((reg (read-char))) (if (viper-valid-register reg) (setq viper-use-register reg) - (error "Viper bell")) + (error viper-ViperBell)) (setq char (read-char)))) (t (setq com char) @@ -1165,7 +1165,7 @@ viper-prefix-arg-com (viper-regsuffix-command-p char) (viper= char ?!) ; bang command (viper= char ?g) ; the gg command (like G0) - (error "Viper bell")) + (error viper-ViperBell)) (setq cmd-to-exec-at-end (viper-exec-form-in-vi `(key-binding (char-to-string ,char))))) @@ -1199,7 +1199,7 @@ viper-prefix-arg-com ((equal com '(?= . ?=)) (viper-line (cons value ?=))) ;; gg acts as G0 ((equal (car com) ?g) (viper-goto-line 0)) - (t (error "Viper bell"))))) + (t (error viper-ViperBell))))) (if cmd-to-exec-at-end (progn @@ -2609,9 +2609,9 @@ viper-forward-char ;; the forward motion before the 'viper-execute-com', but, of ;; course, 'dl' doesn't work on an empty line, so we have to ;; catch that condition before 'viper-execute-com' - (if (and (eolp) (bolp)) (error "Viper bell") (forward-char val)) + (if (and (eolp) (bolp)) (error viper-ViperBell) (forward-char val)) (if com (viper-execute-com 'viper-forward-char val com)) - (if (eolp) (progn (backward-char 1) (error "Viper bell")))) + (if (eolp) (progn (backward-char 1) (error viper-ViperBell)))) (forward-char val) (if com (viper-execute-com 'viper-forward-char val com))))) @@ -2626,7 +2626,7 @@ viper-backward-char (if com (viper-move-marker-locally 'viper-com-point (point))) (if viper-ex-style-motion (progn - (if (bolp) (error "Viper bell") (backward-char val)) + (if (bolp) (error viper-ViperBell) (backward-char val)) (if com (viper-execute-com 'viper-backward-char val com))) (backward-char val) (if com (viper-execute-com 'viper-backward-char val com))))) @@ -2953,7 +2953,7 @@ viper-goto-col (if com (viper-execute-com 'viper-goto-col val com)) (save-excursion (end-of-line) - (if (> val (current-column)) (error "Viper bell"))) + (if (> val (current-column)) (error viper-ViperBell))) )) @@ -3084,7 +3084,7 @@ viper-goto-line ;; If FORWARD then search is forward, otherwise backward. OFFSET is used to ;; adjust point after search. (defun viper-find-char (arg char forward offset) - (or (char-or-string-p char) (error "Viper bell")) + (or (char-or-string-p char) (error viper-ViperBell)) (let ((arg (if forward arg (- arg))) (cmd (if (eq viper-intermediate-command 'viper-repeat) (nth 5 viper-d-com) @@ -3424,7 +3424,7 @@ viper-paren-match (if com (viper-move-marker-locally 'viper-com-point (point))) (backward-sexp 1) (if com (viper-execute-com 'viper-paren-match nil com))) - (t (error "Viper bell")))))) + (t (error viper-ViperBell)))))) (defun viper-toggle-parse-sexp-ignore-comments () (interactive) @@ -4001,7 +4001,7 @@ viper-put-back (let ((reg viper-use-register)) (setq viper-use-register nil) (error viper-EmptyRegister reg)) - (error "Viper bell"))) + (error viper-ViperBell))) (setq viper-use-register nil) (if (viper-end-with-a-newline-p text) (progn @@ -4051,7 +4051,7 @@ viper-Put-back (let ((reg viper-use-register)) (setq viper-use-register nil) (error viper-EmptyRegister reg)) - (error "Viper bell"))) + (error viper-ViperBell))) (setq viper-use-register nil) (if (viper-end-with-a-newline-p text) (beginning-of-line)) (viper-set-destructive-command @@ -4096,7 +4096,7 @@ viper-delete-char (> val (viper-chars-in-region (point) (viper-line-pos 'end)))) (setq val (viper-chars-in-region (point) (viper-line-pos 'end)))) (if (and viper-ex-style-motion (eolp)) - (if (bolp) (error "Viper bell") (setq val 0))) ; not bol---simply back 1 ch + (if (bolp) (error viper-ViperBell) (setq val 0))) ; not bol---simply back 1 ch (save-excursion (viper-forward-char-carefully val) (setq end-del-pos (point))) @@ -4366,7 +4366,7 @@ viper-mark-point ((viper= char ?,) (viper-cycle-through-mark-ring)) ((viper= char ?^) (push-mark viper-saved-mark t t)) ((viper= char ?D) (mark-defun)) - (t (error "Viper bell")) + (t (error viper-ViperBell)) ))) ;; Algorithm: If first invocation of this command save mark on ring, goto @@ -4465,7 +4465,7 @@ viper-goto-mark-subr (switch-to-buffer buff) (goto-char viper-com-point) (viper-change-state-to-vi) - (error "Viper bell"))))) + (error viper-ViperBell))))) ((and (not skip-white) (viper= char ?`)) (if com (viper-move-marker-locally 'viper-com-point (point))) (if (and (viper-same-line (point) viper-last-jump) diff --git a/lisp/emulation/viper-ex.el b/lisp/emulation/viper-ex.el index 4496f1cf7d..28d8e35737 100644 --- a/lisp/emulation/viper-ex.el +++ b/lisp/emulation/viper-ex.el @@ -1240,7 +1240,7 @@ ex-delete (read-string "[Hit return to confirm] ") (quit (save-excursion (kill-buffer " *delete text*")) - (error "Viper bell"))) + (error viper-ViperBell))) (save-excursion (kill-buffer " *delete text*"))) (if ex-buffer (cond ((viper-valid-register ex-buffer '(Letter)) diff --git a/lisp/emulation/viper-init.el b/lisp/emulation/viper-init.el index 0ad9a7a373..91ffc7b48e 100644 --- a/lisp/emulation/viper-init.el +++ b/lisp/emulation/viper-init.el @@ -268,6 +268,10 @@ viper-InvalidViCommand (defconst viper-BadAddress "Ill-formed address" "") (defconst viper-FirstAddrExceedsSecond "First address exceeds second" "") (defconst viper-NoFileSpecified "No file specified" "") +(defconst viper-ViperBell "Viper bell" "") + +(add-to-list 'debug-ignored-errors + (concat "^" (regexp-quote viper-ViperBell) "$")) ;; Is t until viper-mode executes for the very first time. ;; Prevents recursive descend into startup messages.