emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] Changes to emacs/lisp/progmodes/sh-script.el


From: Glenn Morris
Subject: [Emacs-diffs] Changes to emacs/lisp/progmodes/sh-script.el
Date: Wed, 13 Apr 2005 14:49:57 -0400

Index: emacs/lisp/progmodes/sh-script.el
diff -c emacs/lisp/progmodes/sh-script.el:1.148 
emacs/lisp/progmodes/sh-script.el:1.149
*** emacs/lisp/progmodes/sh-script.el:1.148     Fri Apr  8 14:26:12 2005
--- emacs/lisp/progmodes/sh-script.el   Wed Apr 13 18:49:57 2005
***************
*** 555,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)
--- 555,578 ----
  
  
  
! (defcustom sh-here-document-word "EOF"
    "Word to delimit here documents.
! If the first character of this string is \"-\", this is taken as
! part of the redirection operator, rather than part of the
! word (that is, \"<<-\" instead of \"<<\").  This is a feature
! used by some shells (for example Bash) to indicate that leading
! tabs inside the here document should be ignored.  In this case,
! Emacs indents the initial body and end of the here document with
! tabs, to the same level as the start (note that apart from this
! there is no support for indentation of here documents).  This
! will only work correctly if `sh-basic-offset' is a multiple of
! `tab-width'.
! 
! Any quote characters or leading whitespace in the word are
! removed when closing the here document."
!   :type 'string
!   :group 'sh-script)
! 
  
  (defvar sh-test
    '((sh "[  ]" . 3)
***************
*** 3247,3253 ****
     (let ((sh-add-buffer (current-buffer)))
       (list (completing-read "Variable: " 'sh-add-completer)
           (prefix-numeric-value current-prefix-arg))))
!   (insert (sh-feature '((bash . "$[ ")
                        (ksh88 . "$(( ")
                        (posix . "$(( ")
                        (rc . "`{expr $")
--- 3257,3263 ----
     (let ((sh-add-buffer (current-buffer)))
       (list (completing-read "Variable: " 'sh-add-completer)
           (prefix-numeric-value current-prefix-arg))))
!   (insert (sh-feature '((bash . "$(( ")
                        (ksh88 . "$(( ")
                        (posix . "$(( ")
                        (rc . "`{expr $")
***************
*** 3256,3262 ****
          (sh-remember-variable var)
          (if (< delta 0) " - " " + ")
          (number-to-string (abs delta))
!         (sh-feature '((bash . " ]")
                        (ksh88 . " ))")
                        (posix . " ))")
                        (rc . "}")
--- 3266,3272 ----
          (sh-remember-variable var)
          (if (< delta 0) " - " " + ")
          (number-to-string (abs delta))
!         (sh-feature '((bash . " ))")
                        (ksh88 . " ))")
                        (posix . " ))")
                        (rc . "}")
***************
*** 3482,3488 ****
        "esac" >
        \n "done"
        > \n
!       "shift " (sh-add "OPTIND" -1) \n))
  
  
  
--- 3492,3499 ----
        "esac" >
        \n "done"
        > \n
!       "shift " (sh-add "OPTIND" -1) \n
!       "OPTIND=1" \n))
  
  
  
***************
*** 3500,3506 ****
             (match-string 1))))))
  
  
- 
  (defun sh-maybe-here-document (arg)
    "Insert self.  Without prefix, following unquoted `<' inserts here document.
  The document is bounded by `sh-here-document-word'."
--- 3511,3516 ----
***************
*** 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
--- 3521,3541 ----
        (save-excursion
        (backward-char 2)
        (sh-quoted-p))
!       (let ((tabs (if (string-match "\\`-" sh-here-document-word)
!                       (make-string (/ (current-indentation) tab-width) ?\t)
!                     ""))
!             (delim (replace-regexp-in-string "['\"]" ""
!                                             sh-here-document-word)))
        (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]*" "" delim))))))
  
  
  ;; various other commands
***************
*** 3574,3580 ****
  
  This function does not modify the last line of the region if the region ends
  right at the start of the following line; it does not modify blank lines
! at the start of the region.  So you can put the region around an entire 
  shell command and conveniently use this command."
    (interactive "r\nP")
    (save-excursion
--- 3587,3593 ----
  
  This function does not modify the last line of the region if the region ends
  right at the start of the following line; it does not modify blank lines
! at the start of the region.  So you can put the region around an entire
  shell command and conveniently use this command."
    (interactive "r\nP")
    (save-excursion




reply via email to

[Prev in Thread] Current Thread [Next in Thread]