From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2.migadu.com ([2001:41d0:303:e16b::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms8.migadu.com with LMTPS id QNDwHH5k2mX+BAAAe85BDQ:P1 (envelope-from ) for ; Sat, 24 Feb 2024 22:49:50 +0100 Received: from aspmx1.migadu.com ([2001:41d0:303:e16b::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2.migadu.com with LMTPS id QNDwHH5k2mX+BAAAe85BDQ (envelope-from ) for ; Sat, 24 Feb 2024 22:49:50 +0100 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=corwinkerr.com header.s=fm1 header.b=ZcAPCMRL; dkim=pass header.d=messagingengine.com header.s=fm1 header.b=dBmYanRD; dmarc=pass (policy=none) header.from=corwinkerr.com; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1708811390; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:list-id:list-help: list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=Ms2tCErpJbrm4R2ZZCkoIcv5/NX//62QBsl6Ml8zvw0=; b=pDewSH2I+fvRUo+45eLVybKyE13iFIBAYKPpHMrwydhoKPqA+QfJvWE70N89L15mloHfvW jg0JniHxd74hx0KVHYTaZGfJYPuihbdN5YI2EYs6eP2HO0UQ+FBdNfGMSxO4RQZLVE/qTy NN/FbdkOAoovxZslXtR4WKhu/aNKbLeM3QNejb6TCOk8F8ER6T+5y1K0LwJx8JJI+dQMUN ebypRO5jhrY6WhsoyBMJRenf+ZQXTooV1jjqTZNjHIxi1xBURnB9a+XHA2vC4Ezx52kBRZ IaT1EOhNLnpwm53GkOMytVtgFehOLt6YOE2hyvHfAznN3L4SpbQFgptP2VR1eA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=corwinkerr.com header.s=fm1 header.b=ZcAPCMRL; dkim=pass header.d=messagingengine.com header.s=fm1 header.b=dBmYanRD; dmarc=pass (policy=none) header.from=corwinkerr.com; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" ARC-Seal: i=1; s=key1; d=yhetil.org; t=1708811390; a=rsa-sha256; cv=none; b=iTJsVoC9Xg2Mo4aaxU3JUeWxSkbNzcy6Oe9AJsyS5gXKdVdjwB4iEbIh5YM22iFr2njxdo LkG/F3Ta3wpunf6+UhEKn2/29OxnOlxOYRUxsEV56GR/MjBIayZNVxjf8123GcmPt5wQbF 4KupBcA3ExAtxiuFYMcbpCQ80d2wMeZuk+cIkrMS5cANwe704EIbvHht26mSapUB6TZ04j PHVHcHORLgb+u3oPQhdeog6YDygd+ZQgT3vvMNcer+LNe3q3zf2QK+3YYesF2ALSp+dP1B v3PgHU9iLMnmRJkPr8HsScJAmNAZnTk3q21pmpGN5iu8nHR7sQgt1CWqeX/LfA== Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 33FFE3F812 for ; Sat, 24 Feb 2024 22:49:50 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rdyuL-0003Oz-EN; Sat, 24 Feb 2024 15:46:05 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rdyuH-0003Kc-5X for emacs-orgmode@gnu.org; Sat, 24 Feb 2024 15:46:01 -0500 Received: from fout3-smtp.messagingengine.com ([103.168.172.146]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rdyuE-0000IQ-Ij for emacs-orgmode@gnu.org; Sat, 24 Feb 2024 15:46:00 -0500 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailfout.nyi.internal (Postfix) with ESMTP id A3D71138008D for ; Sat, 24 Feb 2024 15:45:57 -0500 (EST) Received: from imap44 ([10.202.2.94]) by compute3.internal (MEProxy); Sat, 24 Feb 2024 15:45:57 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=corwinkerr.com; h=cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:message-id:mime-version:reply-to :subject:subject:to:to; s=fm1; t=1708807557; x=1708893957; bh=Ms 2tCErpJbrm4R2ZZCkoIcv5/NX//62QBsl6Ml8zvw0=; b=ZcAPCMRL8P5eB53LKB mXz+2wihHxiBcAMp1R15q6UhOMYEwU5Jn4RlR1ldvuXYENYBmFrgtLZ9W2SV5l+n 7hPfpsH7mzExr9PqWhU5o/XVYnhuFv5aw57lBHUH6Ejiz/tfO/5FGcprNhG+GqBx S8jh7/2kZFDQGWwhhVXrNiLZv781NzNDseE+CcUQo618zCM57jcTZvebtVh3ZFJM KJA2XTtCCNhuo3L4eZAvThavbBLdiP7smDCRH5wphfbEA147gbHouAaek/Qtmpj4 AAkELazghLTzYHqWJiaAJuLl7i71QxGrKJRcJ5Lozy1+gU8lEbWL8sMex0j2UG+o DMlg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:message-id:mime-version:reply-to:subject:subject:to :to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; t=1708807557; x=1708893957; bh=Ms2tCErpJbrm4R2ZZCkoIcv5/NX/ /62QBsl6Ml8zvw0=; b=dBmYanRD/ugrbdyakd9BkrqKeODvqq5QgZZJoNTZfoCR yI9tbh4MIOuySr/1m+gJoreWnT65EW+9R+4eqNRZH5rEq95tKhRhMDdBzSJTf0c1 cJ84VQKMsC1rSfBpsRJGROBL8zre0YmMXargtxR5D+lFJiH5c0BZomt+aKc6EX/5 6ydfEZajPK6uLTjBGvR0oUDCVnnVzjuQe3+d7txFGPKrH+HH8jPHVB5I+0x2eXTO NOtLW2nqc0lFeGMfFS6lEl9NrxH4k9aM9Pkn34GUS4al3/Bn1ZIcpX9K6dIqBqsV Lyrc8gPj/2U952w3zBSYvfNMcQenDu4TmVczntkrDA== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrfeekgddugedtucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefofgggkfffhffvufgtgfesthhqre dtreertdenucfhrhhomhepfdevohhrfihinhcumfgvrhhrfdcuoegtohhrfihinhestgho rhifihhnkhgvrhhrrdgtohhmqeenucggtffrrghtthgvrhhnpedugfffieejgeeiieeuue ekveetvdelhfelieejiedutdekveeludejgfekfedvtdenucffohhmrghinhepphhrohhj vggtthhsrdhorhhgpdgvmhgrtghsrdgrphhppdhinhguvgigrdhorhhgnecuvehluhhsth gvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheptghorhifihhnsegtohhr fihinhhkvghrrhdrtghomh X-ME-Proxy: Feedback-ID: ifb494469:Fastmail Received: by mailuser.nyi.internal (Postfix, from userid 501) id 6727A36A0079; Sat, 24 Feb 2024 15:45:57 -0500 (EST) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.11.0-alpha0-153-g7e3bb84806-fm-20240215.007-g7e3bb848 MIME-Version: 1.0 Message-Id: Date: Sat, 24 Feb 2024 15:45:22 -0500 From: "Corwin Kerr" To: emacs-orgmode@gnu.org Subject: [BUG] "Not enough arguments for format string" from failed fuzzy search containing % [9.6.19] Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Received-SPF: pass client-ip=103.168.172.146; envelope-from=corwin@corwinkerr.com; helo=fout3-smtp.messagingengine.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: emacs-orgmode-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US X-Migadu-Spam-Score: -9.34 X-Spam-Score: -9.34 X-Migadu-Queue-Id: 33FFE3F812 X-Migadu-Scanner: mx13.migadu.com X-TUID: Oliv2/w/1UV0 Hello, When a search link with a fuzzy expression contains the % character and is not found in the file, the error message is burried by format error. This affects ~org-link-search~, ~org-open-file~, etc. Expected message: : No match for fuzzy expression: % search bad Actual message: : Not enough arguments for format string I ended up with this search term by storing a link to a comment in a tex= file. Here is the backtrace from how I originally discovered it: #+begin_src elisp Debugger entered--Lisp error: (error "Not enough arguments for format = string") format-message("No match for fuzzy expression: % search bad") apply(format-message "No match for fuzzy expression: % search bad") error("No match for fuzzy expression: % search bad") org-open-file(".../bad-file.tex" nil nil "% search bad") apply(org-open-file ".../bad-file.tex" nil (nil "% search bad")) org-link-open-as-file(".../bad-file.tex::% how thi..." nil) org-link-open((link (:type "file" :path ".../bad-file.tex" :format bra= cket :raw-link "file:.../bad-file.tex::% ho..." :application nil :search= -option "% search bad" :begin 8347 :end 8450 :contents-begin 8432 :conte= nts-end 8447 :post-blank 1 :parent (paragraph (:begin 8347 :end 8461 :co= ntents-begin 8347 :contents-end 8460 :post-blank 1 :post-affiliated 8347= :mode nil :granularity element :cached t :parent (section (:begin 8312 = :end 8461 :contents-begin 8312 :contents-end 8460 :robust-begin 8312 :ro= bust-end 8458 :post-blank 1 :post-affiliated 8312 :mode section :granula= rity element :cached t :parent (headline ...) :org-element--cache-sync-k= ey nil)) :org-element--cache-sync-key nil)))) nil) org-open-at-point() org-open-at-mouse((mouse-2 (# 8438 (138 . 35= 5) 272166805 nil 8438 (14 . 16) nil (5 . 5) (11 . 22)))) funcall-interactively(org-open-at-mouse (mouse-2 (# 8438 (138 . 355) 272166805 nil 8438 (14 . 16) nil (5 . 5) (11 . = 22)))) call-interactively(org-open-at-mouse nil nil) command-execute(org-open-at-mouse) #+end_src * Versions GNU Emacs 28.2 (build 1, x86_64-apple-darwin18.7.0, NS appkit-1671.60 Ve= rsion 10.14.6 (Build 18G95)) of 2023-02-22 Org mode version 9.6.19 (release_9.6.19 @ /Users/Corwin/.emacs.d/straigh= t/repos/org/lisp/) * Minimal reproduction #+begin_src tex :tangle bad-file.tex \begin{document} % search attempt \end{document} #+end_src #+begin_src elisp :tangle minimal.el (setq debug-on-error t debug-on-signal nil debug-on-quit nil) ;; Add latest Org mode to load path. (add-to-list 'load-path (expand-file-name "~/.emacs.d/straight/repos/o= rg/lisp")) =20 (org-open-file "bad-file.tex" nil nil "% search attempt") ;; works (org-open-file "bad-file.tex" nil nil "% search bad") ;; error #+end_src Running emacs with : /Applications/Emacs.app/Contents/MacOS/Emacs -Q -l /path/to/minimal.el Generates this backtrace: #+begin_src elisp Debugger entered--Lisp error: (error "Not enough arguments for format = string") format-message("No match for fuzzy expression: % search bad") apply(format-message "No match for fuzzy expression: % search bad") error("No match for fuzzy expression: % search bad") (condition-case err (org-link-search search) (error (funcall save-posi= tion-maybe) (error (nth 1 err)))) (cond (line (org-goto-line line) (if (derived-mode-p 'org-mode) (progn= (org-fold-reveal)))) (search (condition-case err (org-link-search searc= h) (error (funcall save-position-maybe) (error (nth 1 err)))))) (cond ((org-string-nw-p cmd) (setq cmd (org--open-file-format-command = cmd file link link-match-data)) (let ((wconfig (current-window-configura= tion))) (unwind-protect (progn (message "Running %s...done" cmd) (let ((= process-connection-type nil)) (start-process-shell-command cmd nil cmd))= (and (boundp 'org-wait) (numberp org-wait) (sit-for org-wait))) (set-wi= ndow-configuration wconfig)))) ((or (stringp cmd) (eq cmd 'emacs)) (func= all (cdr (assq 'file org-link-frame-setup)) file) (widen) (cond (line (o= rg-goto-line line) (if (derived-mode-p 'org-mode) (progn (org-fold-revea= l)))) (search (condition-case err (org-link-search search) (error (funca= ll save-position-maybe) (error (nth 1 err))))))) ((functionp cmd) (let (= (save-match-data-internal (match-data))) (unwind-protect (progn (set-mat= ch-data link-match-data) (condition-case nil (funcall cmd file link) ((d= ebug wrong-number-of-arguments wrong-type-argument invalid-function) (us= er-error "Please see Org News for version 9.0 about `org-fil..." cmd))))= (set-match-data save-match-data-internal 'evaporate)))) ((consp cmd) (u= ser-error "Please see Org News for version 9.0 about `org-fil..." cmd)) = (t (funcall (cdr (assq 'file org-link-frame-setup)) file))) (let* ((file (if (equal path "") buffer-file-name (substitute-in-file-= name (expand-file-name path)))) (file-apps (append org-file-apps (org--f= ile-default-apps))) (apps (cl-remove-if #'org--file-apps-entry-locator-p= file-apps)) (apps-locator (cl-remove-if-not #'org--file-apps-entry-loca= tor-p file-apps)) (remp (and (assq 'remote apps) (file-remote-p file))) = (dirp (if remp nil (file-directory-p file))) (file (if (and dirp org-ope= n-directory-means-index-dot-org) (concat (file-name-as-directory file) "= index.org") file)) (a-m-a-p (assq 'auto-mode apps)) (dfile (downcase fil= e)) (link (cond (line (concat file "::" (number-to-string line))) (searc= h (concat file "::" search)) (t file))) (ext (and (string-match "\\`.*?\= \.\\([a-zA-Z0-9]+\\(\\.gz\\)?\\)\\'" dfile) (match-string 1 dfile))) (sa= ve-position-maybe (let ((old-buffer (current-buffer)) (old-pos (point)) = (old-mode major-mode)) #'(lambda nil (and (derived-mode-p ...) (eq old-m= ode ...) (or ... ...) (org-mark-ring-push old-pos old-buffer))))) cmd li= nk-match-data) (cond ((member in-emacs '((16) system)) (setq cmd (cdr (a= ssq 'system apps)))) (in-emacs (setq cmd 'emacs)) (t (setq cmd (or (and = remp (cdr (assq ... apps))) (and dirp (cdr (assq ... apps))) (let* ((cas= e-fold-search t) (match ...)) (if match (progn ... match) (progn ... nil= ))) (assoc-default dfile (org--file-apps-regexp-alist apps a-m-a-p) 'str= ing-match) (cdr (assoc ext apps)) (cdr (assq t apps)))))) (if (eq cmd 's= ystem) (progn (setq cmd (cdr (assq 'system apps))))) (if (eq cmd 'defaul= t) (progn (setq cmd (cdr (assoc t apps))))) (if (eq cmd 'mailcap) (progn= (require 'mailcap) (mailcap-parse-mailcaps) (let* ((mime-type (mailcap-= extension-to-mime (or ext ""))) (command (mailcap-mime-info mime-type)))= (if (stringp command) (setq cmd command) (setq cmd 'emacs))))) (if (and= (not (eq cmd 'emacs)) (not (file-exists-p file)) (not org-open-non-exis= ting-files)) (progn (user-error "No such file: %s" file))) (cond ((org-s= tring-nw-p cmd) (setq cmd (org--open-file-format-command cmd file link l= ink-match-data)) (let ((wconfig (current-window-configuration))) (unwind= -protect (progn (message "Running %s...done" cmd) (let (...) (start-proc= ess-shell-command cmd nil cmd)) (and (boundp ...) (numberp org-wait) (si= t-for org-wait))) (set-window-configuration wconfig)))) ((or (stringp cm= d) (eq cmd 'emacs)) (funcall (cdr (assq 'file org-link-frame-setup)) fil= e) (widen) (cond (line (org-goto-line line) (if (derived-mode-p 'org-mod= e) (progn (org-fold-reveal)))) (search (condition-case err (org-link-sea= rch search) (error (funcall save-position-maybe) (error ...)))))) ((func= tionp cmd) (let ((save-match-data-internal (match-data))) (unwind-protec= t (progn (set-match-data link-match-data) (condition-case nil (funcall c= md file link) (... ...))) (set-match-data save-match-data-internal 'evap= orate)))) ((consp cmd) (user-error "Please see Org News for version 9.0 = about `org-fil..." cmd)) (t (funcall (cdr (assq 'file org-link-frame-set= up)) file))) (funcall save-position-maybe)) org-open-file("bad-file.tex" nil nil "% search bad") eval-buffer(# nil "/Users/Corwin/projects/comp-lang/em= acs/minimal.el" nil t) ; Reading at buffer position 315 load-with-code-conversion("/Users/Corwin/projects/comp-lang/emacs/mini= mal.el" "/Users/Corwin/projects/comp-lang/emacs/minimal.el" nil t) load("/Users/Corwin/projects/comp-lang/emacs/minimal.el" nil t) command-line-1(("-l" "/Users/Corwin/projects/comp-lang/emacs/minimal.e= l")) command-line() normal-top-level() #+end_src