unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#22069: 25.0.50; bogus %S in cl-no-applicable-method message
@ 2015-12-01 17:14 stephen_leake
  2015-12-01 18:30 ` Stephen Leake
  2015-12-01 21:25 ` Stefan Monnier
  0 siblings, 2 replies; 3+ messages in thread
From: stephen_leake @ 2015-12-01 17:14 UTC (permalink / raw)
  To: 22069


In emacs-25 branch, starting from emacs -Q, eval in *scratch*:

(progn
 (require 'xref)
 (setq xref-backend-functions (lambda () 'my-xref-backend))
 (xref-find-definitions "foo"))

The first time gives a *Backtrace* buffer; don't quit, run it again to
get the error message:

   cl-no-applicable-method: No applicable method for %S: xref-backend-definitions, my-xref-backend, "foo"

The %S is not used as a `format' argument.

This comes from cl-generic.el line 803:

(define-error 'cl-no-applicable-method "No applicable method for %S"
  'cl-no-method)

which is used on line 812:

(cl-defgeneric cl-no-applicable-method (generic &rest args)
  "Function called when a method call finds no applicable method."
  (signal 'cl-no-applicable-method `(,(cl--generic-name generic) ,@args)))

Apparently `signal' does not use the error-message string as a `format'
argument, but just a plain string.

In GNU Emacs 25.0.50.1 (x86_64-w64-mingw32)
 of 2015-11-30
Repository revision: ca6edca2429c01dd7905c0de835bbdb23754b754
Windowing system distributor 'Microsoft Corp.', version 6.3.9600
Configured features:
XPM JPEG TIFF GIF PNG RSVG SOUND NOTIFY ACL GNUTLS LIBXML2 ZLIB
TOOLKIT_SCROLL_BARS

Important settings:
  value of $LANG: en_US.UTF-8
  locale-coding-system: cp1252

Major mode: Emacs-Lisp

Minor modes in effect:
  diff-auto-refine-mode: t
  project-ml-xref-mode: t
  global-ede-mode: t
  ede-minor-mode: t
  other-frame-window-mode: t
  display-time-mode: t
  delete-selection-mode: t
  icomplete-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent messages:
Mark set
Mark saved where search started
Mark set
Mark saved where search started
Mark set [2 times]
Mark saved where search started
Auto-saving...
Mark set [2 times]
Saving file c:/home/stephe/projects.text...
Wrote c:/home/stephe/projects.text

Load-path shadows:
c:/home/stephe/.emacs.d/elpa/ada-ref-man-2012.0/ada-ref-man hides /Projects/org.emacs.ada-mode/ada-ref-man
/Projects/org.emacs.ada-mode/ada-xref hides c:/Projects/emacs/scratch/stephe-25/lisp/progmodes/ada-xref
/Projects/org.emacs.ada-mode/ada-stmt hides c:/Projects/emacs/scratch/stephe-25/lisp/progmodes/ada-stmt
/Projects/org.emacs.ada-mode/ada-prj hides c:/Projects/emacs/scratch/stephe-25/lisp/progmodes/ada-prj
/Projects/org.emacs.ada-mode/ada-mode hides c:/Projects/emacs/scratch/stephe-25/lisp/progmodes/ada-mode

Features:
(shadow sort mail-extr emacsbug message rfc822 mml mml-sec mm-decode
mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader
sendmail rfc2047 rfc2045 ietf-drums mail-utils pp xmtn-dvc
xmtn-conflicts xmtn-ids dvc-persistence dvc-config xmtn-automate
xmtn-run xmtn-match xmtn-basic-io xmtn-base dvc-status dvc-diff
dvc-log-edit ediff-merg ediff-wind ediff-diff ediff-mult ediff-help
ediff-init ediff-util ediff add-log gpr-query make-mode rect debug
sh-script smie executable copyright character-fold misearch
multi-isearch pulse vc-git diff-mode map semantic/wisent/grammar
semantic/bovine semantic/grammar semantic/idle semantic/grammar-wy
semantic/format semantic/tag-ls semantic/find semantic/ctxt
semantic/lex-spp vc vc-dispatcher vc-mtn project-settings ede/generic
semantic/db ede/shell ede/config eieio-opt ada-project xref-ada ada-skel
ada-skeletons skeleton ada-compiler ada-gnat-compile ada-xref-tool
ada-gnat-xref gnat-core ada-indent-engine ada-wisi
ada-indent-user-options ada-grammar-wy wisi-compile wisi wisi-parse
wisi-compat-24.2 semantic/wisent semantic/wisent/wisent ada-fix-error
ada-build ada-mode-compat-24.2 ada-mode find-file align
project-multi-lang xref-patches semantic/symref semantic/util-modes
semantic/util semantic semantic/tag semantic/lex semantic/fw mode-local
project-menu project-patches ede/emacs ede/speedbar ede/files ede
ede/detect ede/base ede/auto ede/source eieio-base eieio-speedbar
speedbar sb-image ezimage dframe eieio-custom cedet etags seq
org-element org-rmail org-mhe org-irc org-info org-gnus org-docview
doc-view jka-compr image-mode org-bibtex bibtex org-bbdb org-w3m
org-mode-keys org org-macro org-footnote org-pcomplete pcomplete
org-list org-faces org-entities org-version ob-emacs-lisp ob ob-tangle
ob-ref ob-lob ob-table ob-exp org-src ob-keys ob-comint ob-core ob-eval
org-compat org-macs org-loaddefs format-spec find-func cal-menu calendar
cal-loaddefs xgit-core xmtn-minimal dvc-autoloads dvc-unified ffap
thingatpt url-parse auth-source gnus-util mm-util help-fns mail-prsvr
password-cache url-vars dvc-fileinfo dvc-core dvc-buffers dvc-ui
dvc-register dvc-utils ewoc dvc-emacs dvc-defs other-frame-window time
delsel cus-start cus-load color-theme edmacro kmacro wid-edit cl
noutline outline easy-mmode xref cl-seq project eieio byte-opt bytecomp
byte-compile cl-extra help-mode cconv eieio-core whitespace dired-x
dired-aux dired compile comint ansi-color ring cl-macs gv uniquify-files
path-iterator cl-loaddefs pcase cl-lib icomplete finder-inf info package
easymenu epg-config time-date mule-util tooltip eldoc electric uniquify
ediff-hook vc-hooks lisp-float-type mwheel dos-w32 ls-lisp disp-table
w32-win w32-vars term/common-win tool-bar dnd fontset image regexp-opt
fringe tabulated-list newcomment elisp-mode lisp-mode prog-mode register
page menu-bar rfn-eshadow timer select scroll-bar mouse jit-lock
font-lock syntax facemenu font-core frame cl-generic cham georgian
utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean
japanese eucjp-ms cp51932 hebrew greek romanian slovak czech european
ethiopic indian cyrillic chinese charscript case-table epa-hook
jka-cmpr-hook help simple abbrev minibuffer cl-preloaded nadvice
loaddefs button faces cus-face macroexp files text-properties overlay
sha1 md5 base64 format env code-pages mule custom widget
hashtable-print-readable backquote w32notify w32 multi-tty
make-network-process emacs)

Memory information:
((conses 16 488326 85520)
 (symbols 56 41558 0)
 (miscs 48 460 1287)
 (strings 32 107084 16234)
 (string-bytes 1 2782558)
 (vectors 16 44569)
 (vector-slots 8 1552193 152910)
 (floats 8 865 479)
 (intervals 56 7417 1456)
 (buffers 976 47))





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

* bug#22069: 25.0.50; bogus %S in cl-no-applicable-method message
  2015-12-01 17:14 bug#22069: 25.0.50; bogus %S in cl-no-applicable-method message stephen_leake
@ 2015-12-01 18:30 ` Stephen Leake
  2015-12-01 21:25 ` Stefan Monnier
  1 sibling, 0 replies; 3+ messages in thread
From: Stephen Leake @ 2015-12-01 18:30 UTC (permalink / raw)
  To: 22069

stephen_leake@stephe-leake.org writes:

> This comes from cl-generic.el line 803:
>
> (define-error 'cl-no-applicable-method "No applicable method for %S"
>   'cl-no-method)

This patch fixes the problem for me, and seems appropriate for Emacs 25.

diff --git a/lisp/emacs-lisp/cl-generic.el b/lisp/emacs-lisp/cl-generic.el
index 9e6102c..23d53ac 100644
--- a/lisp/emacs-lisp/cl-generic.el
+++ b/lisp/emacs-lisp/cl-generic.el
@@ -797,23 +797,24 @@ methods.")
 
 ;;; Define some pre-defined generic functions, used internally.
 
-(define-error 'cl-no-method "No method for %S")
-(define-error 'cl-no-next-method "No next method for %S" 'cl-no-method)
-(define-error 'cl-no-primary-method "No primary method for %S" 'cl-no-method)
-(define-error 'cl-no-applicable-method "No applicable method for %S"
+(define-error 'cl-no-method "No method")
+(define-error 'cl-no-next-method "No next method" 'cl-no-method)
+(define-error 'cl-no-primary-method "No primary method" 'cl-no-method)
+(define-error 'cl-no-applicable-method "No applicable method"
   'cl-no-method)
 
 (cl-defgeneric cl-no-next-method (generic method &rest args)
   "Function called when `cl-call-next-method' finds no next method."
-  (signal 'cl-no-next-method `(,(cl--generic-name generic) ,method ,@args)))
+  (signal 'cl-no-next-method (append (list (format "%S" (cl--generic-name generic)) method) args)))
 
 (cl-defgeneric cl-no-applicable-method (generic &rest args)
   "Function called when a method call finds no applicable method."
-  (signal 'cl-no-applicable-method `(,(cl--generic-name generic) ,@args)))
+  (signal 'cl-no-applicable-method
+          (append (list (format "%S" (cl--generic-name generic))) args)))
 
 (cl-defgeneric cl-no-primary-method (generic &rest args)
   "Function called when a method call finds no primary method."
-  (signal 'cl-no-primary-method `(,(cl--generic-name generic) ,@args)))
+  (signal 'cl-no-primary-method (append (list (format (cl--generic-name generic))) args)))
 
 (defun cl-call-next-method (&rest _args)
   "Function to call the next applicable method.


-- 
-- Stephe





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

* bug#22069: 25.0.50; bogus %S in cl-no-applicable-method message
  2015-12-01 17:14 bug#22069: 25.0.50; bogus %S in cl-no-applicable-method message stephen_leake
  2015-12-01 18:30 ` Stephen Leake
@ 2015-12-01 21:25 ` Stefan Monnier
  1 sibling, 0 replies; 3+ messages in thread
From: Stefan Monnier @ 2015-12-01 21:25 UTC (permalink / raw)
  To: stephen_leake; +Cc: 22069

>    cl-no-applicable-method: No applicable method for %S: xref-backend-definitions, my-xref-backend, "foo"

> The %S is not used as a `format' argument.

Indeed, I was confused.

> (define-error 'cl-no-applicable-method "No applicable method for %S"
>   'cl-no-method)

This should just be 

  (define-error 'cl-no-applicable-method "No applicable method"
    'cl-no-method)

> -(define-error 'cl-no-method "No method for %S")
> -(define-error 'cl-no-next-method "No next method for %S" 'cl-no-method)
> -(define-error 'cl-no-primary-method "No primary method for %S" 'cl-no-method)
> -(define-error 'cl-no-applicable-method "No applicable method for %S"
> +(define-error 'cl-no-method "No method")
> +(define-error 'cl-no-next-method "No next method" 'cl-no-method)
> +(define-error 'cl-no-primary-method "No primary method" 'cl-no-method)
> +(define-error 'cl-no-applicable-method "No applicable method"
>    'cl-no-method)

Looks good.

>  (cl-defgeneric cl-no-next-method (generic method &rest args)
>    "Function called when `cl-call-next-method' finds no next method."
> -  (signal 'cl-no-next-method `(,(cl--generic-name generic) ,method ,@args)))
> +  (signal 'cl-no-next-method (append (list (format "%S" (cl--generic-name generic)) method) args)))
>
>  (cl-defgeneric cl-no-applicable-method (generic &rest args)
>    "Function called when a method call finds no applicable method."
> -  (signal 'cl-no-applicable-method `(,(cl--generic-name generic) ,@args)))
> +  (signal 'cl-no-applicable-method
> +          (append (list (format "%S" (cl--generic-name generic))) args)))
>
>  (cl-defgeneric cl-no-primary-method (generic &rest args)
>    "Function called when a method call finds no primary method."
> -  (signal 'cl-no-primary-method `(,(cl--generic-name generic) ,@args)))
> +  (signal 'cl-no-primary-method (append (list (format (cl--generic-name generic))) args)))
>
>  (defun cl-call-next-method (&rest _args)
>    "Function to call the next applicable method.

No, these should stay as they are, I think.


        Stefan





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

end of thread, other threads:[~2015-12-01 21:25 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-12-01 17:14 bug#22069: 25.0.50; bogus %S in cl-no-applicable-method message stephen_leake
2015-12-01 18:30 ` Stephen Leake
2015-12-01 21:25 ` Stefan Monnier

Code repositories for project(s) associated with this public inbox

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

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