From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Glenn Morris Newsgroups: gmane.emacs.devel Subject: Re: sh-here-document-word should be customizable Date: Fri, 08 Apr 2005 18:02:41 +0100 Message-ID: <26k6ndjj66.fsf@xpc14.ast.cam.ac.uk> References: <4n8y3ubjkd.fsf@lifelogs.com> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1112980003 25369 80.91.229.2 (8 Apr 2005 17:06:43 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 8 Apr 2005 17:06:43 +0000 (UTC) Cc: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Apr 08 19:06:41 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1DJwvP-0006tC-3l for ged-emacs-devel@m.gmane.org; Fri, 08 Apr 2005 19:05:43 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1DJwUw-0003fm-1J for ged-emacs-devel@m.gmane.org; Fri, 08 Apr 2005 12:38:22 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1DJwUQ-0003OZ-E7 for emacs-devel@gnu.org; Fri, 08 Apr 2005 12:37:50 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1DJwUN-0003ML-8K for emacs-devel@gnu.org; Fri, 08 Apr 2005 12:37:48 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1DJwUN-0003H7-2e for emacs-devel@gnu.org; Fri, 08 Apr 2005 12:37:47 -0400 Original-Received: from [131.111.8.137] (helo=ppsw-7.csi.cam.ac.uk) by monty-python.gnu.org with esmtp (Exim 4.34) id 1DJwtU-0005xf-Ht for emacs-devel@gnu.org; Fri, 08 Apr 2005 13:03:44 -0400 Original-Received: from cass41.ast.cam.ac.uk ([131.111.69.186]:45166) by ppsw-7.csi.cam.ac.uk (ppsw.cam.ac.uk [131.111.8.137]:25) with esmtp id 1DJwsU-00042q-N3 (Exim 4.51) (return-path ); Fri, 08 Apr 2005 18:02:42 +0100 Original-Received: from xserv2.ast.cam.ac.uk (IDENT:xAhsPL6OFeLmIQeJ+StT//qmnfRiTzpa@xserv2.ast.cam.ac.uk [131.111.69.236]) by cass41.ast.cam.ac.uk (8.12.10+Sun/8.12.10) with ESMTP id j38H2foL011617; Fri, 8 Apr 2005 18:02:41 +0100 (BST) Original-Received: from xalph3.ast.cam.ac.uk (IDENT:c4sT+MeAauYz83+MdXprOqMdDCGR+jfh@xpc14.ast.cam.ac.uk [131.111.69.34]) by xserv2.ast.cam.ac.uk (8.11.6/8.11.6) with ESMTP id j38H2fc24508; Fri, 8 Apr 2005 18:02:41 +0100 Original-To: Kevin Rodgers X-Spook: secure d-day Khmer Rouge Farabundo Marti Hizballah data X-Ran: wN7n}UuL0IpD76XvBeMU=|u^q6(S_lnX;'G9\=dkfV1}lhu/NCck@ZJ3oRfP?U)Y\Pq9mW X-Hue: dark orchid X-Attribution: GM Mail-Followup-To: Kevin Rodgers , emacs-devel@gnu.org In-Reply-To: (Kevin Rodgers's message of "Fri, 08 Apr 2005 10:13:59 -0600") User-Agent: Gnus (www.gnus.org), GNU Emacs (www.gnu.org/software/emacs/) X-Cam-ScannerInfo: http://www.cam.ac.uk/cs/email/scanner/ X-Cam-AntiVirus: No virus found X-Cam-SpamDetails: Not scanned X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:35772 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:35772 Kevin Rodgers wrote: > Here's a patch... Whee - you just beat me! :) Here's my version, FWIW. *************** *** 557,568 **** (defvar sh-here-document-word "EOF" "Word to delimit here documents. ! If the first character of this string is \"-\", this character will ! be removed from the string when it is used to close the here document. ! This convention is used by the Bash shell, for example, to indicate ! that leading tabs inside the here document should be ignored. ! Note that Emacs currently has no support for indenting inside here ! documents - you must insert literal tabs by hand.") (defvar sh-test '((sh "[ ]" . 3) --- 557,570 ---- (defvar sh-here-document-word "EOF" "Word to delimit here documents. ! Leading whitespace is removed from this string when closing the ! here document. If the first character is \"-\", this is also ! removed when closing the here document. Also in this case, the ! body and end of the here document are indented using tabs, to the ! same level as the start of the here document. This will only ! work correctly if `sh-basic-offset' is a multiple of ! `tab-width'.") ! (defvar sh-test '((sh "[ ]" . 3) *************** *** 3511,3528 **** (save-excursion (backward-char 2) (sh-quoted-p)) ! (progn (insert sh-here-document-word) (or (eolp) (looking-at "[ \t]") (insert ? )) (end-of-line 1) (while (sh-quoted-p) (end-of-line 2)) ! (newline) (save-excursion ! (insert ?\n (substring ! sh-here-document-word ! (if (string-match "^-" sh-here-document-word) 1 0))))))) ;; various other commands --- 3513,3531 ---- (save-excursion (backward-char 2) (sh-quoted-p)) ! (let ((tabs (if (string-match "\\`-" sh-here-document-word) ! (make-string (/ (current-indentation) tab-width) ?\t) ! ""))) (insert sh-here-document-word) (or (eolp) (looking-at "[ \t]") (insert ? )) (end-of-line 1) (while (sh-quoted-p) (end-of-line 2)) ! (insert ?\n tabs) (save-excursion ! (insert ?\n tabs (replace-regexp-in-string ! "\\`-?[ \t]*" "" sh-here-document-word)))))) ;; various other commands