]> code.delx.au - gnu-emacs/blobdiff - lisp/progmodes/dcl-mode.el
Update copyright year to 2014 by running admin/update-copyright.
[gnu-emacs] / lisp / progmodes / dcl-mode.el
index 2ee02ea6f483d7af0ce0b77a97ba9eced965b661..289ca3f84711645ff7045d02c2a114cdcc245a4b 100644 (file)
@@ -1,7 +1,6 @@
 ;;; dcl-mode.el --- major mode for editing DCL command files
 
-;; Copyright (C) 1997, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
-;; Free Software Foundation, Inc.
+;; Copyright (C) 1997, 2001-2014 Free Software Foundation, Inc.
 
 ;; Author: Odd Gripenstam <gripenstamol@decus.se>
 ;; Maintainer: Odd Gripenstam <gripenstamol@decus.se>
@@ -99,7 +98,7 @@ Presently this includes some syntax, .OP.erators, and \"f$\" lexicals.")
   :group 'languages)
 
 (defcustom dcl-basic-offset 4
-  "*Number of columns to indent a block in DCL.
+  "Number of columns to indent a block in DCL.
 A block is the commands between THEN-ELSE-ENDIF and between the commands
 dcl-block-begin-regexp and dcl-block-end-regexp.
 
@@ -110,7 +109,7 @@ dcl-calc-command-indent-function is set to a function."
 
 
 (defcustom dcl-continuation-offset 6
-  "*Number of columns to indent a continuation line in DCL.
+  "Number of columns to indent a continuation line in DCL.
 A continuation line is a line that follows a line ending with `-'.
 
 The meaning of this variable may be changed if
@@ -120,7 +119,7 @@ dcl-calc-cont-indent-function is set to a function."
 
 
 (defcustom dcl-margin-offset 8
-  "*Indentation for the first command line in DCL.
+  "Indentation for the first command line in DCL.
 The first command line in a file or after a SUBROUTINE statement is indented
 this much.  Other command lines are indented the same number of columns as
 the preceding command line.
@@ -130,7 +129,7 @@ A command line is a line that starts with `$'."
 
 
 (defcustom dcl-margin-label-offset 2
-  "*Number of columns to indent a margin label in DCL.
+  "Number of columns to indent a margin label in DCL.
 A margin label is a label that doesn't begin or end a block, i.e. it
 doesn't match dcl-block-begin-regexp or dcl-block-end-regexp."
   :type 'integer
@@ -138,28 +137,28 @@ doesn't match dcl-block-begin-regexp or dcl-block-end-regexp."
 
 
 (defcustom dcl-comment-line-regexp "^\\$!"
-  "*Regexp describing the start of a comment line in DCL.
+  "Regexp describing the start of a comment line in DCL.
 Comment lines are not indented."
   :type 'regexp
   :group 'dcl)
 
 
 (defcustom dcl-block-begin-regexp "loop[0-9]*:"
-  "*Regexp describing a command that begins an indented block in DCL.
+  "Regexp describing a command that begins an indented block in DCL.
 Set to nil to only indent at THEN-ELSE-ENDIF."
   :type 'regexp
   :group 'dcl)
 
 
 (defcustom dcl-block-end-regexp "endloop[0-9]*:"
-  "*Regexp describing a command that ends an indented block in DCL.
+  "Regexp describing a command that ends an indented block in DCL.
 Set to nil to only indent at THEN-ELSE-ENDIF."
   :type 'regexp
   :group 'dcl)
 
 
 (defcustom dcl-calc-command-indent-function nil
-  "*Function to calculate indentation for a command line in DCL.
+  "Function to calculate indentation for a command line in DCL.
 If this variable is non-nil it is called as a function:
 
 \(func INDENT-TYPE CUR-INDENT EXTRA-INDENT LAST-POINT THIS-POINT)
@@ -169,8 +168,8 @@ nil to get the default indentation.
 
 INDENT-TYPE is a symbol indicating what kind of indentation should be done.
 It can have the following values:
-  indent      the lines indentation should be increased, e.g. after THEN.
-  outdent     the lines indentation should be decreased, e.g a line with ENDIF.
+  indent      the indentation should be increased, e.g., after THEN.
+  outdent     the indentation should be decreased, e.g., a line with ENDIF.
   first-line  indentation for the first line in a buffer or SUBROUTINE.
 CUR-INDENT is the indentation of the preceding command line.
 EXTRA-INDENT is the default change in indentation for this line
@@ -191,7 +190,7 @@ This package includes two functions suitable for this:
 
 
 (defcustom dcl-calc-cont-indent-function 'dcl-calc-cont-indent-relative
-  "*Function to calculate indentation for a continuation line.
+  "Function to calculate indentation for a continuation line.
 If this variable is non-nil it is called as a function:
 
 \(func CUR-INDENT EXTRA-INDENT)
@@ -209,7 +208,7 @@ This package includes one function suitable for this:
 
 
 (defcustom dcl-tab-always-indent t
-  "*Controls the operation of the TAB key in DCL mode.
+  "Controls the operation of the TAB key in DCL mode.
 If t, pressing TAB always indents the current line.
 If nil, pressing TAB indents the current line if point is at the left margin.
 Data lines (i.e. lines not part of a command line or continuation line) are
@@ -219,43 +218,43 @@ never indented."
 
 
 (defcustom dcl-electric-characters t
-  "*Non-nil means reindent immediately when a label, ELSE or ENDIF is inserted."
+  "Non-nil means reindent immediately when a label, ELSE or ENDIF is inserted."
   :type 'boolean
   :group 'dcl)
 
 
 (defcustom dcl-tempo-comma ", "
-  "*Text to insert when a comma is needed in a template, in DCL mode."
+  "Text to insert when a comma is needed in a template, in DCL mode."
   :type 'string
   :group 'dcl)
 
 (defcustom dcl-tempo-left-paren "("
-  "*Text to insert when a left parenthesis is needed in a template in DCL."
+  "Text to insert when a left parenthesis is needed in a template in DCL."
   :type 'string
   :group 'dcl)
 
 
 (defcustom dcl-tempo-right-paren ")"
-  "*Text to insert when a right parenthesis is needed in a template in DCL."
+  "Text to insert when a right parenthesis is needed in a template in DCL."
   :type 'string
   :group 'dcl)
 
 ; I couldn't decide what looked best, so I'll let you decide...
 ; Remember, you can also customize this with imenu-submenu-name-format.
 (defcustom dcl-imenu-label-labels "Labels"
-  "*Imenu menu title for sub-listing with label names."
+  "Imenu menu title for sub-listing with label names."
   :type 'string
   :group 'dcl)
 (defcustom dcl-imenu-label-goto "GOTO"
-  "*Imenu menu title for sub-listing with GOTO statements."
+  "Imenu menu title for sub-listing with GOTO statements."
   :type 'string
   :group 'dcl)
 (defcustom dcl-imenu-label-gosub "GOSUB"
-  "*Imenu menu title for sub-listing with GOSUB statements."
+  "Imenu menu title for sub-listing with GOSUB statements."
   :type 'string
   :group 'dcl)
 (defcustom dcl-imenu-label-call "CALL"
-  "*Imenu menu title for sub-listing with CALL statements."
+  "Imenu menu title for sub-listing with CALL statements."
   :type 'string
   :group 'dcl)
 
@@ -266,7 +265,7 @@ never indented."
     (,dcl-imenu-label-goto "\\s-GOTO[ \t]+\\([A-Za-z0-9_\$]+\\)" 1)
     (,dcl-imenu-label-gosub "\\s-GOSUB[ \t]+\\([A-Za-z0-9_\$]+\\)" 1)
     (,dcl-imenu-label-call "\\s-CALL[ \t]+\\([A-Za-z0-9_\$]+\\)" 1))
-  "*Default imenu generic expression for DCL.
+  "Default imenu generic expression for DCL.
 
 The default includes SUBROUTINE labels in the main listing and
 sub-listings for other labels, CALL, GOTO and GOSUB statements.
@@ -276,7 +275,7 @@ See `imenu-generic-expression' for details."
 
 
 (defcustom dcl-mode-hook nil
-  "*Hook called by `dcl-mode'."
+  "Hook called by `dcl-mode'."
   :type 'hook
   :group 'dcl)
 
@@ -401,7 +400,7 @@ optionally followed by a comment, followed by a newline."
 
 (defcustom dcl-electric-reindent-regexps
   (list "endif" "else" dcl-label-r)
-  "*Regexps that can trigger an electric reindent.
+  "Regexps that can trigger an electric reindent.
 A list of regexps that will trigger a reindent if the last letter
 is defined as dcl-electric-character.
 
@@ -513,7 +512,7 @@ Variables controlling indentation style and extra features:
  dcl-block-begin-regexp
  dcl-block-end-regexp
     Regexps that match command lines that begin and end, respectively,
-    a block of commmand lines that will be given extra indentation.
+    a block of command lines that will be given extra indentation.
     Command lines between THEN-ELSE-ENDIF are always indented; these variables
     make it possible to define other places to indent.
     Set to nil to disable this feature.
@@ -663,8 +662,7 @@ There is some minimal font-lock support (see vars
 (defun dcl-end-of-command ()
   "Move point to end of current command or next command if not on a command."
   (interactive)
-  (let ((type (dcl-get-line-type))
-       (start (point)))
+  (let ((type (dcl-get-line-type)))
     (if (or (eq type '$)
            (eq type '-))
        (progn
@@ -710,7 +708,7 @@ Returns point of the found command line or nil if not able to move."
            (setq done t)               ; not a label-only line, exit the loop
            (setq retval (point))))
        ;; We couldn't go further back, and we haven't found a command yet.
-       ;; Return to the start positionn
+       ;; Return to the start position.
        (goto-char start)
        (setq done t)
        (setq retval nil)))
@@ -758,7 +756,7 @@ Returns point of the found command line or nil if not able to move."
              (setq done t)             ; not a label-only line, exit the loop
              (setq retval (point)))))
        ;; We couldn't go further back, and we haven't found a command yet.
-       ;; Return to the start positionn
+       ;; Return to the start position.
        (goto-char start)
        (setq done t)
        (setq retval nil)))
@@ -942,7 +940,7 @@ Returns one of the following symbols:
 
 ;;;---------------------------------------------------------------------------
 (defun dcl-calc-command-indent-multiple
-  (indent-type cur-indent extra-indent last-point this-point)
+  (indent-type cur-indent extra-indent _last-point _this-point)
   "Indent lines to a multiple of dcl-basic-offset.
 
 Set dcl-calc-command-indent-function to this function to customize
@@ -1186,7 +1184,7 @@ The indent-type classification could probably be expanded upon.
 
 
 ;;;---------------------------------------------------------------------------
-(defun dcl-calc-cont-indent-relative (cur-indent extra-indent)
+(defun dcl-calc-cont-indent-relative (_cur-indent _extra-indent)
   "Indent continuation lines to align with words on previous line.
 
 Indent continuation lines to a position relative to preceding
@@ -1541,7 +1539,7 @@ Also remove the continuation mark if easily detected."
 
 
 ;;;-------------------------------------------------------------------------
-(defun dcl-option-value-basic (option-assoc)
+(defun dcl-option-value-basic (_option-assoc)
   "Guess a value for basic-offset."
   (save-excursion
     (dcl-beginning-of-command)
@@ -1576,7 +1574,7 @@ Also remove the continuation mark if easily detected."
 
 
 ;;;-------------------------------------------------------------------------
-(defun dcl-option-value-offset (option-assoc)
+(defun dcl-option-value-offset (_option-assoc)
   "Guess a value for an offset.
 Find the column of the first non-blank character on the line.
 Returns the column offset."
@@ -1587,7 +1585,7 @@ Returns the column offset."
 
 
 ;;;-------------------------------------------------------------------------
-(defun dcl-option-value-margin-offset (option-assoc)
+(defun dcl-option-value-margin-offset (_option-assoc)
   "Guess a value for margin offset.
 Find the column of the first non-blank character on the line, not
 counting labels.
@@ -1599,7 +1597,7 @@ Returns a number as a string."
 
 
 ;;;-------------------------------------------------------------------------
-(defun dcl-option-value-comment-line (option-assoc)
+(defun dcl-option-value-comment-line (_option-assoc)
   "Guess a value for `dcl-comment-line-regexp'.
 Must return a string."
   ;; Should we set comment-start and comment-start-skip as well?
@@ -1790,8 +1788,7 @@ Set or update the value of VAR in the current buffers
            (if (eolp) (error "Missing colon in local variables entry"))
            (skip-chars-backward " \t")
            (let* ((str (buffer-substring beg (point)))
-                  (found-var (read str))
-                  val)
+                  (found-var (read str)))
              ;; Setting variable named "end" means end of list.
              (if (string-equal (downcase str) "end")
                  (progn
@@ -1896,6 +1893,10 @@ section at the end of the current buffer."
 
 
 ;;;-------------------------------------------------------------------------
+(with-no-warnings
+  ;; Dynamically bound in `dcl-save-mode'.
+  (defvar mode))
+
 (defun dcl-save-mode ()
   "Save the current mode for this buffer.
 Save the current mode in a `Local Variables:'
@@ -1903,7 +1904,7 @@ section at the end of the current buffer."
   (interactive)
   (let ((mode (prin1-to-string major-mode)))
     (if (string-match "-mode$" mode)
-       (let ((mode (intern (substring mode  0 (match-beginning 0)))))
+       (let ((mode (intern (substring mode 0 (match-beginning 0)))))
          (dcl-save-option 'mode))
       (message "Strange mode: %s" mode))))