From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.bugs Subject: bug#33475: [Wish list]: Display line and column numbers in warnings with `compile-defun' Date: Fri, 23 Nov 2018 17:58:39 +0000 Message-ID: <20181123175839.GA14199@ACM> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: blaine.gmane.org 1542996009 28911 195.159.176.226 (23 Nov 2018 18:00:09 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Fri, 23 Nov 2018 18:00:09 +0000 (UTC) User-Agent: Mutt/1.10.1 (2018-07-13) To: 33475@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Nov 23 19:00:04 2018 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gQFkJ-0007Oj-L4 for geb-bug-gnu-emacs@m.gmane.org; Fri, 23 Nov 2018 19:00:03 +0100 Original-Received: from localhost ([::1]:53788 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gQFmQ-00034B-0A for geb-bug-gnu-emacs@m.gmane.org; Fri, 23 Nov 2018 13:02:14 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:55720) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gQFmJ-000345-Lk for bug-gnu-emacs@gnu.org; Fri, 23 Nov 2018 13:02:08 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gQFmE-0000uG-Jh for bug-gnu-emacs@gnu.org; Fri, 23 Nov 2018 13:02:07 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:40245) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gQFmE-0000uC-G6 for bug-gnu-emacs@gnu.org; Fri, 23 Nov 2018 13:02:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1gQFmE-0004Jh-BO for bug-gnu-emacs@gnu.org; Fri, 23 Nov 2018 13:02:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Alan Mackenzie Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 23 Nov 2018 18:02:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 33475 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.154299611616579 (code B ref -1); Fri, 23 Nov 2018 18:02:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 23 Nov 2018 18:01:56 +0000 Original-Received: from localhost ([127.0.0.1]:44503 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gQFm8-0004JL-BT for submit@debbugs.gnu.org; Fri, 23 Nov 2018 13:01:56 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:46051) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gQFm7-0004JA-Mj for submit@debbugs.gnu.org; Fri, 23 Nov 2018 13:01:56 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gQFm1-0000be-Qg for submit@debbugs.gnu.org; Fri, 23 Nov 2018 13:01:50 -0500 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:38858) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gQFm1-0000ba-MI for submit@debbugs.gnu.org; Fri, 23 Nov 2018 13:01:49 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:55639) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gQFly-00033o-Us for bug-gnu-emacs@gnu.org; Fri, 23 Nov 2018 13:01:49 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gQFlu-0000AL-2O for bug-gnu-emacs@gnu.org; Fri, 23 Nov 2018 13:01:46 -0500 Original-Received: from colin.muc.de ([193.149.48.1]:36813 helo=mail.muc.de) by eggs.gnu.org with smtp (Exim 4.71) (envelope-from ) id 1gQFlt-0008UW-Mw for bug-gnu-emacs@gnu.org; Fri, 23 Nov 2018 13:01:42 -0500 Original-Received: (qmail 53851 invoked by uid 3782); 23 Nov 2018 18:01:39 -0000 Original-Received: from acm.muc.de (p2E5D5CB0.dip0.t-ipconnect.de [46.93.92.176]) by colin.muc.de (tmda-ofmipd) with ESMTP; Fri, 23 Nov 2018 19:01:39 +0100 Original-Received: (qmail 14204 invoked by uid 1000); 23 Nov 2018 17:58:39 -0000 Content-Disposition: inline X-Delivery-Agent: TMDA/1.1.12 (Macallan) X-Primary-Address: acm@muc.de X-detected-operating-system: by eggs.gnu.org: FreeBSD 9.x [fuzzy] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 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.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:152716 Archived-At: Hello, Emacs. At the moment, if a warning is displayed for a compilation started by `compile-defun', it appears something like: Warning: assignment to free variable `foo' . This is all very well, but it lacks the line and column number of the place of the warning, meaning one must search through the source and guess where the warning is. Why not output this information, much like is done in a batch compilation? It would then look like: Buffer winkler2.el:3:14:Warning: assignment to free variable `foo' . This would save guessing and irritation. Here is a patch which achieves this: diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el index 0b8f8824b4..d16d0d3f22 100644 --- a/lisp/emacs-lisp/bytecomp.el +++ b/lisp/emacs-lisp/bytecomp.el @@ -1165,7 +1165,7 @@ byte-compile-log-file (with-current-buffer (get-buffer-create byte-compile-log-buffer) (goto-char (point-max)) (let* ((inhibit-read-only t) - (dir (and byte-compile-current-file + (dir (and (stringp byte-compile-current-file) (file-name-directory byte-compile-current-file))) (was-same (equal default-directory dir)) pt) @@ -1981,7 +1981,7 @@ compile-defun (save-excursion (end-of-defun) (beginning-of-defun) - (let* ((byte-compile-current-file nil) + (let* ((byte-compile-current-file (current-buffer)) (byte-compile-current-buffer (current-buffer)) (byte-compile-read-position (point)) (byte-compile-last-position byte-compile-read-position) -- Alan Mackenzie (Nuremberg, Germany).