GNU bug report logs - #25379
26.0.50; Minor: Call looking-back as advertised

Previous Next

Package: emacs;

Reported by: Rolf Ade <rolf <at> pointsman.de>

Date: Fri, 6 Jan 2017 18:32:02 UTC

Severity: wishlist

Found in version 26.0.50

Done: Rolf Ade <rolf <at> pointsman.de>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 25379 in the body.
You can then email your comments to 25379 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#25379; Package emacs. (Fri, 06 Jan 2017 18:32:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Rolf Ade <rolf <at> pointsman.de>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Fri, 06 Jan 2017 18:32:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Rolf Ade <rolf <at> pointsman.de>
To: bug-gnu-emacs <at> gnu.org
Subject: 26.0.50; Minor: Call looking-back as advertised
Date: Fri, 06 Jan 2017 19:30:35 +0100
Since emacs 25.1

C-h f looking-back RET

shows:

looking-back is a compiled Lisp function in ‘subr.el’.

(looking-back REGEXP LIMIT &optional GREEDY)
...

This is because of

  (declare
   (advertised-calling-convention (regexp limit &optional greedy) "25.1"))

at the start of the looking-back implementation.

It still can be called with only one argument (in this cases LIMIT will
default to nil) and there are still a few such calls in the emacs core
lisp code.

This doesn't do any harm other than unnecessary

"[...]Warning: looking-back called with 1 argument, but requires 2-3"

noise in the compiling output while byte-compiling that files.

The patch below silence that (simply by explicitly adding nil as second
argument). This handles all such calls, that an el-search-load-path with
the pattern `(looking-back ,_) found (see
https://elpa.gnu.org/packages/el-search.html) with an appropriate
load-path. That means, if that works as promoted: this patch handles all
such cases curently still in the core.

Commit message:

* lisp/emulation/viper-ex.el (ex-cmd-read-exit):
* lisp/org/org.el (org-read-date-minibuffer-local-map):
* lisp/progmodes/hideshow.el (hs-hide-block-at-point):
* lisp/progmodes/sql.el (sql-end-of-statement): Call looking-back as
advertised.

Copyright-paperwork-exempt: yes


diff --git a/lisp/emulation/viper-ex.el b/lisp/emulation/viper-ex.el
index edc71ea..3fdeadb 100644
--- a/lisp/emulation/viper-ex.el
+++ b/lisp/emulation/viper-ex.el
@@ -548,9 +548,9 @@ ex-cmd-read-exit
       (setq viper-ex-work-buf (get-buffer-create viper-ex-work-buf-name))
       (set-buffer viper-ex-work-buf)
       (goto-char (point-max)))
-    (cond ((looking-back quit-regex1) (exit-minibuffer))
-	  ((looking-back stay-regex)  (insert " "))
-	  ((looking-back quit-regex2) (exit-minibuffer))
+    (cond ((looking-back quit-regex1 nil) (exit-minibuffer))
+	  ((looking-back stay-regex nil)  (insert " "))
+	  ((looking-back quit-regex2 nil) (exit-minibuffer))
 	  (t (insert " ")))))
 
 (declare-function viper-tmp-insert-at-eob "viper-cmd" (msg))
diff --git a/lisp/org/org.el b/lisp/org/org.el
index 02a7a0c..2659a4d 100644
--- a/lisp/org/org.el
+++ b/lisp/org/org.el
@@ -16249,7 +16249,7 @@ org-read-date-minibuffer-local-map
     (org-defkey map (kbd ".")
                 (lambda () (interactive)
 		  ;; Are we at the beginning of the prompt?
-		  (if (looking-back "^[^:]+: ")
+		  (if (looking-back "^[^:]+: " nil)
 		      (org-eval-in-calendar '(calendar-goto-today))
 		    (insert "."))))
     (org-defkey map (kbd "C-.")
diff --git a/lisp/progmodes/hideshow.el b/lisp/progmodes/hideshow.el
index 0e4e670..5328526 100644
--- a/lisp/progmodes/hideshow.el
+++ b/lisp/progmodes/hideshow.el
@@ -582,7 +582,7 @@ hs-hide-block-at-point
 	  (setq p (line-end-position)))
 	;; `q' is the point at the end of the block
 	(hs-forward-sexp mdata 1)
-	(setq q (if (looking-back hs-block-end-regexp)
+	(setq q (if (looking-back hs-block-end-regexp nil)
 		    (match-beginning 0)
 		  (point)))
         (when (and (< p q) (> (count-lines p q) 1))
diff --git a/lisp/progmodes/sql.el b/lisp/progmodes/sql.el
index d6c9516..06ef4df 100644
--- a/lisp/progmodes/sql.el
+++ b/lisp/progmodes/sql.el
@@ -2790,7 +2790,7 @@ sql-end-of-statement
     ;; Iterate until we've moved the desired number of stmt ends
     (while (not (= (cl-signum arg) 0))
       ;; if we're looking at the terminator, jump by 2
-      (if (or (and (> 0 arg) (looking-back term))
+      (if (or (and (> 0 arg) (looking-back term nil))
               (and (< 0 arg) (looking-at term)))
           (setq n 2)
         (setq n 1))



In GNU Emacs 26.0.50.5 (x86_64-unknown-linux-gnu, GTK+ Version 2.24.10)
 of 2017-01-06 built on linux-qg7d
Repository revision: 8f0376309ee37e4f1da21d78971c4df2df5fd7b6
Windowing system distributor 'The X.Org Foundation', version 11.0.11203000
System Description:	openSUSE 12.2 (x86_64)





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#25379; Package emacs. (Fri, 06 Jan 2017 18:56:02 GMT) Full text and rfc822 format available.

Message #8 received at 25379 <at> debbugs.gnu.org (full text, mbox):

From: Glenn Morris <rgm <at> gnu.org>
To: Rolf Ade <rolf <at> pointsman.de>
Cc: 25379 <at> debbugs.gnu.org
Subject: Re: bug#25379: 26.0.50; Minor: Call looking-back as advertised
Date: Fri, 06 Jan 2017 13:55:11 -0500
But it's better to figure out a real limit, and the warning from
having none specified reminds us of that, so IMO it's better to leave
as-is till someone does that (or verifies that point-min is the best
that can be done).




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#25379; Package emacs. (Fri, 06 Jan 2017 21:41:01 GMT) Full text and rfc822 format available.

Message #11 received at 25379 <at> debbugs.gnu.org (full text, mbox):

From: Rolf Ade <rolf <at> pointsman.de>
To: Glenn Morris <rgm <at> gnu.org>
Cc: 25379 <at> debbugs.gnu.org
Subject: Re: bug#25379: 26.0.50; Minor: Call looking-back as advertised
Date: Fri, 06 Jan 2017 22:39:57 +0100
Glenn Morris <rgm <at> gnu.org> writes:
> But it's better to figure out a real limit, and the warning from
> having none specified reminds us of that, so IMO it's better to leave
> as-is till someone does that (or verifies that point-min is the best
> that can be done).

Ah ..., OK, then.

So, you say, all that lisp compiling warnings during a fresh emacs
build are such 'reminders'?

And this is "wishlist" instead of "wontfix" because you would like to
get that fixed, but in a better way then by my 'just pacify
byte-compiling' patch?




Reply sent to Rolf Ade <rolf <at> pointsman.de>:
You have taken responsibility. (Tue, 30 Jul 2019 21:42:02 GMT) Full text and rfc822 format available.

Notification sent to Rolf Ade <rolf <at> pointsman.de>:
bug acknowledged by developer. (Tue, 30 Jul 2019 21:42:02 GMT) Full text and rfc822 format available.

Message #16 received at 25379-done <at> debbugs.gnu.org (full text, mbox):

From: Rolf Ade <rolf <at> pointsman.de>
To: 25379-done <at> debbugs.gnu.org
Subject: Re: bug#25379: 26.0.50; Minor: Call looking-back as advertised
Date: Tue, 30 Jul 2019 23:41:23 +0200
Rolf Ade <rolf <at> pointsman.de> writes:
> Since emacs 25.1
>
> C-h f looking-back RET
>
> shows:
>
> looking-back is a compiled Lisp function in ‘subr.el’.
>
> (looking-back REGEXP LIMIT &optional GREEDY)
> ...
>
> This is because of
>
>   (declare
>    (advertised-calling-convention (regexp limit &optional greedy) "25.1"))
>
> at the start of the looking-back implementation.
>
> It still can be called with only one argument (in this cases LIMIT will
> default to nil) and there are still a few such calls in the emacs core
> lisp code.
>
> This doesn't do any harm other than unnecessary
>
> "[...]Warning: looking-back called with 1 argument, but requires 2-3"
>
> noise in the compiling output while byte-compiling that files.
>
> The patch below silence that (simply by explicitly adding nil as second
> argument). This handles all such calls, that an el-search-load-path with
> the pattern `(looking-back ,_) found (see
> https://elpa.gnu.org/packages/el-search.html) with an appropriate
> load-path. That means, if that works as promoted: this patch handles all
> such cases curently still in the core.
>
> Commit message:
>
> * lisp/emulation/viper-ex.el (ex-cmd-read-exit):
> * lisp/org/org.el (org-read-date-minibuffer-local-map):
> * lisp/progmodes/hideshow.el (hs-hide-block-at-point):
> * lisp/progmodes/sql.el (sql-end-of-statement): Call looking-back as
> advertised.
>
> Copyright-paperwork-exempt: yes
>
>
> diff --git a/lisp/emulation/viper-ex.el b/lisp/emulation/viper-ex.el
> index edc71ea..3fdeadb 100644
> --- a/lisp/emulation/viper-ex.el
> +++ b/lisp/emulation/viper-ex.el
> @@ -548,9 +548,9 @@ ex-cmd-read-exit
>        (setq viper-ex-work-buf (get-buffer-create viper-ex-work-buf-name))
>        (set-buffer viper-ex-work-buf)
>        (goto-char (point-max)))
> -    (cond ((looking-back quit-regex1) (exit-minibuffer))
> -	  ((looking-back stay-regex)  (insert " "))
> -	  ((looking-back quit-regex2) (exit-minibuffer))
> +    (cond ((looking-back quit-regex1 nil) (exit-minibuffer))
> +	  ((looking-back stay-regex nil)  (insert " "))
> +	  ((looking-back quit-regex2 nil) (exit-minibuffer))
>  	  (t (insert " ")))))
>  
>  (declare-function viper-tmp-insert-at-eob "viper-cmd" (msg))
> diff --git a/lisp/org/org.el b/lisp/org/org.el
> index 02a7a0c..2659a4d 100644
> --- a/lisp/org/org.el
> +++ b/lisp/org/org.el
> @@ -16249,7 +16249,7 @@ org-read-date-minibuffer-local-map
>      (org-defkey map (kbd ".")
>                  (lambda () (interactive)
>  		  ;; Are we at the beginning of the prompt?
> -		  (if (looking-back "^[^:]+: ")
> +		  (if (looking-back "^[^:]+: " nil)
>  		      (org-eval-in-calendar '(calendar-goto-today))
>  		    (insert "."))))
>      (org-defkey map (kbd "C-.")
> diff --git a/lisp/progmodes/hideshow.el b/lisp/progmodes/hideshow.el
> index 0e4e670..5328526 100644
> --- a/lisp/progmodes/hideshow.el
> +++ b/lisp/progmodes/hideshow.el
> @@ -582,7 +582,7 @@ hs-hide-block-at-point
>  	  (setq p (line-end-position)))
>  	;; `q' is the point at the end of the block
>  	(hs-forward-sexp mdata 1)
> -	(setq q (if (looking-back hs-block-end-regexp)
> +	(setq q (if (looking-back hs-block-end-regexp nil)
>  		    (match-beginning 0)
>  		  (point)))
>          (when (and (< p q) (> (count-lines p q) 1))
> diff --git a/lisp/progmodes/sql.el b/lisp/progmodes/sql.el
> index d6c9516..06ef4df 100644
> --- a/lisp/progmodes/sql.el
> +++ b/lisp/progmodes/sql.el
> @@ -2790,7 +2790,7 @@ sql-end-of-statement
>      ;; Iterate until we've moved the desired number of stmt ends
>      (while (not (= (cl-signum arg) 0))
>        ;; if we're looking at the terminator, jump by 2
> -      (if (or (and (> 0 arg) (looking-back term))
> +      (if (or (and (> 0 arg) (looking-back term nil))
>                (and (< 0 arg) (looking-at term)))
>            (setq n 2)
>          (setq n 1))
>
>
>
> In GNU Emacs 26.0.50.5 (x86_64-unknown-linux-gnu, GTK+ Version 2.24.10)
>  of 2017-01-06 built on linux-qg7d
> Repository revision: 8f0376309ee37e4f1da21d78971c4df2df5fd7b6
> Windowing system distributor 'The X.Org Foundation', version 11.0.11203000
> System Description:	openSUSE 12.2 (x86_64)


All the in this bug mentioned looking-at are in the meantimenow called
with the advertised two args; no warning message regarding to this
created anymore. This was done. (By others, mostly in the way I proposed
in my patch.)




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 28 Aug 2019 11:24:05 GMT) Full text and rfc822 format available.

This bug report was last modified 4 years and 235 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.