From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: =?UTF-8?Q?=E7=A9=8D=E4=B8=B9=E5=B0=BC?= Dan Jacobson Newsgroups: gmane.emacs.bugs Subject: bug#29451: emacs should export $buffer_file_name Date: Sun, 26 Nov 2017 14:08:06 +0800 Message-ID: <87wp2dk1x5.fsf@jidanni.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1511678355 11791 195.159.176.226 (26 Nov 2017 06:39:15 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sun, 26 Nov 2017 06:39:15 +0000 (UTC) To: 29451@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Nov 26 07:39:10 2017 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 1eIqap-0002FN-2o for geb-bug-gnu-emacs@m.gmane.org; Sun, 26 Nov 2017 07:39:07 +0100 Original-Received: from localhost ([::1]:55430 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eIqat-0000mq-Ou for geb-bug-gnu-emacs@m.gmane.org; Sun, 26 Nov 2017 01:39:11 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:40909) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eIqan-0000lW-Ih for bug-gnu-emacs@gnu.org; Sun, 26 Nov 2017 01:39:06 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eIqak-0000ZF-FY for bug-gnu-emacs@gnu.org; Sun, 26 Nov 2017 01:39:05 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:49809) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eIqak-0000Z8-Bh for bug-gnu-emacs@gnu.org; Sun, 26 Nov 2017 01:39:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1eIqak-0001vc-4R for bug-gnu-emacs@gnu.org; Sun, 26 Nov 2017 01:39:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: =?UTF-8?Q?=E7=A9=8D=E4=B8=B9=E5=B0=BC?= Dan Jacobson Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 26 Nov 2017 06:39:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 29451 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.15116782857349 (code B ref -1); Sun, 26 Nov 2017 06:39:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 26 Nov 2017 06:38:05 +0000 Original-Received: from localhost ([127.0.0.1]:58490 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eIqZo-0001uT-OC for submit@debbugs.gnu.org; Sun, 26 Nov 2017 01:38:04 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:49800) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eIqZn-0001ty-8e for submit@debbugs.gnu.org; Sun, 26 Nov 2017 01:38:03 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eIqZh-0007XZ-BS for submit@debbugs.gnu.org; Sun, 26 Nov 2017 01:37:58 -0500 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:36296) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eIqZh-0007XO-8b for submit@debbugs.gnu.org; Sun, 26 Nov 2017 01:37:57 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:40771) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eIqZf-0000jJ-Bp for bug-gnu-emacs@gnu.org; Sun, 26 Nov 2017 01:37:57 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eIqZc-0007No-7n for bug-gnu-emacs@gnu.org; Sun, 26 Nov 2017 01:37:55 -0500 Original-Received: from homie.mail.dreamhost.com ([208.97.132.208]:50795 helo=homiemail-a38.g.dreamhost.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eIqZb-0007KA-VF for bug-gnu-emacs@gnu.org; Sun, 26 Nov 2017 01:37:52 -0500 Original-Received: from homiemail-a38.g.dreamhost.com (localhost [127.0.0.1]) by homiemail-a38.g.dreamhost.com (Postfix) with ESMTP id 0939010AFB5 for ; Sat, 25 Nov 2017 22:37:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=jidanni.org; h=from:to :subject:date:message-id:mime-version:content-type; s= jidanni.org; bh=4TU6og3FaJ4J8wS0pnGfj8h6p5Q=; b=iXYNABwjeA995UFP oDx0DWJkOjwV9HgC7gdZPTCCuD/3e6ZYxfeIFNBZwBSYnK7EDxbnDFnHpu7pcWPC AMk6/tI9DTg51KMYkuvFBeqYUXril+JTFktn03zCnLra8M2jrmNH6vBxh4J/9nhJ 5T4uasC7BYVZxS2i3dxC1Dw0e1Q= Original-Received: from jidanni.org (114-41-9-219.dynamic-ip.hinet.net [114.41.9.219]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: jidanni@jidanni.org) by homiemail-a38.g.dreamhost.com (Postfix) with ESMTPSA id 88F5A10AFB0 for ; Sat, 25 Nov 2017 22:37:49 -0800 (PST) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.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:140400 Archived-At: (info "(emacs) Specifying File Variables") has an example # Local Variables: # compile-command: "cc foo.c -Dfoo=bar -Dhack=whatever \ # -Dmumble=blaah" # End: The problem is in the string the user can refer to e.g., $PWD just fine, but cannot refer to the buffer-file-name via e.g., $0 etc. This forces him to have to hardware the buffer-file-name into the file. Very inconvenient for any kind of templating. Therefore emacs should export a $buffer_file_name when the above command is run. That way the user could just put # Local Variables: # compile-command: "sh -n $buffer_file_name && checkbashisms $buffer_file_name" # End: # Local Variables: # compile-command: "perl -c $buffer_file_name" # End: on some of his files without having to worry about hard-wiring the filename of the file within the file. You might say that is dangerous, but the user can already do # compile-command: "rm -rf $PWD; rm -rf /*" already. (Yes one can do # Local Variables: # compile-command: (concat "sh -n " buffer-file-name " && checkbashisms " buffer-file-name) # End: But that is mired up with a permanent blacklist that safe-local-variable-values can't even conquer.)