unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Robert Weiner <rsw@gnu.org>
To: 48294@debbugs.gnu.org
Subject: bug#48294: Use 'with-current-buffer' byte-compiler warning seems wrong
Date: Sat, 8 May 2021 16:14:09 -0400	[thread overview]
Message-ID: <CA+OMD9gq44n7wNR7YSuGfY58P32N+ACY0GrGegqkJEqJGnrvGA@mail.gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 1300 bytes --]

Hi:

I get a lot of these byte-compile warnings in my Elisp code:

hbut.el:683:26:Warning: Use ‘with-current-buffer’ rather than
    save-excursion+set-buffer

but since with-current-buffer does not save the value of point, it is
not a valid substitute for save-excursion and should not be suggested.
Evaluate the two samples below and you will see that they are not
equivalent.  If I am correct, I'd like this suggestion disabled.  Thanks.
 -- rsw

(save-excursion
  (set-buffer (current-buffer))
  (forward-char 20))

(with-current-buffer (current-buffer)
  (forward-char 20))

------


In GNU Emacs 27.1.90 (build 1, x86_64-apple-darwin18.7.0, NS appkit-1671.60
Version 10.14.6 (Build 18G95))
 of 2020-12-18 built on builder10-14.porkrind.org
Windowing system distributor 'Apple', version 10.3.1894
System Description:  Mac OS X 10.15.7

Configured using:
 'configure --with-ns '--enable-locallisppath=/Library/Application
 Support/Emacs/${version}/site-lisp:/Library/Application
 Support/Emacs/site-lisp' --with-modules'

Configured features:
NOTIFY KQUEUE ACL GNUTLS LIBXML2 ZLIB TOOLKIT_SCROLL_BARS NS MODULES
THREADS JSON PDUMPER

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

Major mode: Lisp Interaction

[-- Attachment #2: Type: text/html, Size: 1630 bytes --]

             reply	other threads:[~2021-05-08 20:14 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-08 20:14 Robert Weiner [this message]
2021-05-09  8:05 ` bug#48294: Use 'with-current-buffer' byte-compiler warning seems wrong Eli Zaretskii
2021-05-09 15:57   ` Robert Weiner
2021-05-09 16:11     ` Eli Zaretskii
2021-05-09 18:09       ` Robert Weiner
2021-05-09 18:24         ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CA+OMD9gq44n7wNR7YSuGfY58P32N+ACY0GrGegqkJEqJGnrvGA@mail.gmail.com \
    --to=rsw@gnu.org \
    --cc=48294@debbugs.gnu.org \
    --cc=rswgnu@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).