unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Glenn Morris <gmorris+emacs@ast.cam.ac.uk>
Cc: emacs-devel@gnu.org
Subject: Re: sh-here-document-word should be customizable
Date: Fri, 08 Apr 2005 18:02:41 +0100	[thread overview]
Message-ID: <26k6ndjj66.fsf@xpc14.ast.cam.ac.uk> (raw)
In-Reply-To: <d36afp$d6q$1@sea.gmane.org> (Kevin Rodgers's message of "Fri, 08 Apr 2005 10:13:59 -0600")

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)))))))
  
  \f
  ;; 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))))))
  
  \f
  ;; various other commands

  reply	other threads:[~2005-04-08 17:02 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-04-07 17:09 sh-here-document-word should be customizable Ted Zlatanov
2005-04-07 21:31 ` Kevin Rodgers
2005-04-08 16:13   ` Kevin Rodgers
2005-04-08 17:02     ` Glenn Morris [this message]
2005-05-02 16:33   ` Daniel Brockman
2005-04-08  3:22 ` Richard Stallman
2005-04-11 17:30   ` Ted Zlatanov
2005-04-13 18:56     ` Glenn Morris

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=26k6ndjj66.fsf@xpc14.ast.cam.ac.uk \
    --to=gmorris+emacs@ast.cam.ac.uk \
    --cc=emacs-devel@gnu.org \
    /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).