From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: haj@posteo.de (Harald =?UTF-8?Q?J=C3=B6rg?=) Newsgroups: gmane.emacs.bugs Subject: bug#47549: 26.3; cperl-mode: buffer view is being re-positioned outside user control [PATCH] fixed! Date: Fri, 02 Apr 2021 00:58:11 +0200 Message-ID: <87tuop1ukc.fsf@hajtower> References: <8735w93c7t.fsf@hajtower> <87y2e11uql.fsf_-_@hajtower> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="29697"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) Cc: 47549@debbugs.gnu.org To: Jim McKim Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Apr 02 00:59:28 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lS6Hf-0007d6-V8 for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 02 Apr 2021 00:59:28 +0200 Original-Received: from localhost ([::1]:46650 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lS6He-0004fM-HI for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 01 Apr 2021 18:59:26 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:58458) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lS6HG-0004fG-OK for bug-gnu-emacs@gnu.org; Thu, 01 Apr 2021 18:59:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:47289) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lS6HG-0007qA-HU for bug-gnu-emacs@gnu.org; Thu, 01 Apr 2021 18:59:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lS6HG-0006Ju-GQ for bug-gnu-emacs@gnu.org; Thu, 01 Apr 2021 18:59:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: haj@posteo.de (Harald =?UTF-8?Q?J=C3=B6rg?=) Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 01 Apr 2021 22:59:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 47549 X-GNU-PR-Package: emacs Original-Received: via spool by 47549-submit@debbugs.gnu.org id=B47549.161731790124248 (code B ref 47549); Thu, 01 Apr 2021 22:59:02 +0000 Original-Received: (at 47549) by debbugs.gnu.org; 1 Apr 2021 22:58:21 +0000 Original-Received: from localhost ([127.0.0.1]:58835 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lS6Gb-0006J0-Ep for submit@debbugs.gnu.org; Thu, 01 Apr 2021 18:58:21 -0400 Original-Received: from mout02.posteo.de ([185.67.36.66]:54379) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lS6GZ-0006Il-6o for 47549@debbugs.gnu.org; Thu, 01 Apr 2021 18:58:20 -0400 Original-Received: from submission (posteo.de [89.146.220.130]) by mout02.posteo.de (Postfix) with ESMTPS id DCB972400FB for <47549@debbugs.gnu.org>; Fri, 2 Apr 2021 00:58:12 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.de; s=2017; t=1617317892; bh=gUzQV/rM2NeIf065X5WIcxYfacnHD4QtvRvE70hbUeA=; h=From:To:Cc:Subject:Date:From; b=lOcdK2Aegk1DT9rY2FEY3wZLnwbdbPMdVeEEP2uUpghz7Z4DmylzrQClaTdixcW5B AhdF2Dy3OHsnrgTlqIoBLVP5/pwJkDYjq7mvjDIZCnHnp5thVGIH1i5gPM7c+JM9yD EphMZucQhE5RTkuT8PpnwOJoJVZgQTF68SKYX+d4qQLWCAeQpKqg+Uv1a5g/71mfcB F+xenV/mCVfH8Op60RO9WXaS/Twkk4IgSpHZMX+IVCd0YILYthYrh2XT4XLOV1t3ba w3zbpip7+egOK3xili93x2h7rxiAMn3GBZbgsGNmy6or/ZWZHvdV3jZqB8GyC8fuY9 aqpU71zTaGzlw== Original-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4FBJW8290kz9rxH; Fri, 2 Apr 2021 00:58:12 +0200 (CEST) In-Reply-To: <87y2e11uql.fsf_-_@hajtower> ("Harald \=\?utf-8\?Q\?J\=C3\=B6rg\=22'\?\= \=\?utf-8\?Q\?s\?\= message of "Fri, 02 Apr 2021 00:54:26 +0200") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:203453 Archived-At: --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable haj@posteo.de (Harald J=C3=B6rg) writes: > haj@posteo.de (Harald J=C3=B6rg) writes: > >> The patch avoids this situation by postponing any output from >> `cperl-find-pods-heres' until the code has restored the original window >> position. This works for me in interactive tests. > > Sorry - the previous message contained a bad patch. Please use the > attached patch instead! Oh my. It's too late. This time I forgot to actually attach the patch. --=20 Sorry, haj --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=0001-cperl-mode-Don-t-reposition-the-window-when-writing-.patch Content-Description: cperl-mode: Don't reposition windows >From 42b13aa9bfba74c7a4c6e9285f768615772fda8c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Harald=20J=C3=B6rg?= Date: Fri, 2 Apr 2021 00:46:38 +0200 Subject: [PATCH] ; cperl-mode: Don't reposition the window when writing messages * lisp/progmodes/cperl-mode.el (cperl-find-pods-heres): Avoid printing messages while point is off-screen (Bug#47549) --- lisp/progmodes/cperl-mode.el | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/lisp/progmodes/cperl-mode.el b/lisp/progmodes/cperl-mode.el index 7612f8d284..7878e91096 100644 --- a/lisp/progmodes/cperl-mode.el +++ b/lisp/progmodes/cperl-mode.el @@ -3608,7 +3608,8 @@ cperl-find-pods-heres ;; 1+6+2+1+1+6+1+1+1=20 extra () before this: "\\|" "\\\\\\(['`\"($]\\)") ; BACKWACKED something-hairy - "")))) + ""))) + warning-message) (unwind-protect (progn (save-excursion @@ -3671,7 +3672,7 @@ cperl-find-pods-heres (looking-at "\\(cut\\|end\\)\\>")) (if (or (nth 3 state) (nth 4 state) ignore-max) nil ; Doing a chunk only - (message "=cut is not preceded by a POD section") + (setq warning-message "=cut is not preceded by a POD section") (or (car err-l) (setcar err-l (point)))) (beginning-of-line) @@ -3686,7 +3687,7 @@ cperl-find-pods-heres (goto-char b) (if (re-search-forward "\n=\\(cut\\|end\\)\\>" stop-point 'toend) (progn - (message "=cut is not preceded by an empty line") + (setq warning-message "=cut is not preceded by an empty line") (setq b1 t) (or (car err-l) (setcar err-l b)))))) (beginning-of-line 2) ; An empty line after =cut is not POD! @@ -3829,7 +3830,8 @@ cperl-find-pods-heres (progn ; Pretend we matched at the end (goto-char (point-max)) (re-search-forward "\\'") - (message "End of here-document `%s' not found." tag) + (setq warning-message + (format "End of here-document `%s' not found." tag)) (or (car err-l) (setcar err-l b)))) (if cperl-pod-here-fontify (progn @@ -3906,7 +3908,8 @@ cperl-find-pods-heres 'face font-lock-string-face) (cperl-commentify (point) (+ (point) 2) nil) (cperl-put-do-not-fontify (point) (+ (point) 2) t)) - (message "End of format `%s' not found." name) + (setq warning-message + (format "End of format `%s' not found." name)) (or (car err-l) (setcar err-l b))) (forward-line) (if (> (point) max) @@ -4426,8 +4429,9 @@ cperl-find-pods-heres REx-subgr-end argument) ; continue (setq argument nil))) (and argument - (message "Couldn't find end of charclass in a REx, pos=%s" - REx-subgr-start)) + (setq warning-message + (format "Couldn't find end of charclass in a REx, pos=%s" + REx-subgr-start))) (setq argument (1- (point))) (goto-char REx-subgr-end) (cperl-highlight-charclass @@ -4483,7 +4487,8 @@ cperl-find-pods-heres (setq qtag "Can't find })"))) (progn (goto-char (1- e)) - (message "%s" qtag)) + (setq warning-message + (format "%s" qtag))) (cperl-postpone-fontification (1- tag) (1- (point)) 'face font-lock-variable-name-face) @@ -4512,9 +4517,9 @@ cperl-find-pods-heres ;; (1- e) 'toend) (search-forward ")" (1- e) 'toend) ;;) - (message - "Couldn't find end of (?#...)-comment in a REx, pos=%s" - REx-subgr-start)))) + (setq warning-message + (format "Couldn't find end of (?#...)-comment in a REx, pos=%s" + REx-subgr-start))))) (if (>= (point) e) (goto-char (1- e))) (cond @@ -4592,8 +4597,8 @@ cperl-find-pods-heres (if (> (point) stop-point) (progn (if end - (message "Garbage after __END__/__DATA__ ignored") - (message "Unbalanced syntax found while scanning") + (setq warning-message "Garbage after __END__/__DATA__ ignored") + (setq warning-message "Unbalanced syntax found while scanning") (or (car err-l) (setcar err-l b))) (goto-char stop-point)))) (setq cperl-syntax-state (cons state-point state) @@ -4612,6 +4617,7 @@ cperl-find-pods-heres ;; cperl-mode-syntax-table. ;; (set-syntax-table cperl-mode-syntax-table) ) + (when warning-message (message warning-message)) (list (car err-l) overshoot))) (defun cperl-find-pods-heres-region (min max) -- 2.20.1 --=-=-=--