Function: dcl-guess-option

dcl-guess-option is a byte-compiled function defined in dcl-mode.el.gz.

Signature

(dcl-guess-option)

Documentation

Guess what option the user wants to set by looking around in the code.

Returns the name of the option variable as a string.

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/dcl-mode.el.gz
;;;-------------------------------------------------------------------------
(defun dcl-guess-option ()
  "Guess what option the user wants to set by looking around in the code.
Returns the name of the option variable as a string."
  (let ((case-fold-search t))
    (cond
     ;; Continued line
     ((eq (dcl-get-line-type) '-)
      "dcl-calc-cont-indent-function")
     ;; Comment line
     ((save-excursion
	(beginning-of-line)
	(looking-at "^\\$[ \t]*!"))
      "dcl-comment-line-regexp")
     ;; Margin offset: subroutine statement or first line in buffer
     ;; Test this before label indentation to detect a subroutine
     ((save-excursion
	(beginning-of-line)
	(or (looking-at (concat "^\\$[ \t]*" dcl-label-r dcl-ws-r
				"subroutine"))
	    (save-excursion
	      (not (dcl-backward-command t)))))
      "dcl-margin-offset")
     ;; Margin offset: on command line after subroutine statement
     ((save-excursion
	(beginning-of-line)
	(and (eq (dcl-get-line-type) '$)
	     (dcl-backward-command)
	     (looking-at (concat "^\\$[ \t]*" dcl-label-r dcl-ws-r
				 "subroutine"))))
      "dcl-margin-offset")
     ;; Label indentation
     ((save-excursion
	(beginning-of-line)
	(and (looking-at (concat "^\\$[ \t]*" dcl-label-r))
	     (not (and dcl-block-begin-regexp
		       (looking-at (concat "^\\$[ \t]*"
					   dcl-block-begin-regexp))))
	     (not (and dcl-block-end-regexp
		       (looking-at (concat "^\\$[ \t]*"
					   dcl-block-end-regexp))))))
      "dcl-margin-label-offset")
     ;; Basic offset
     ((and (eq (dcl-get-line-type) '$)	; beginning of command
	   (save-excursion
	     (beginning-of-line)
	     (let* ((this-indent (save-excursion
				   (dcl-back-to-indentation)
				   (current-column)))
		    (prev-indent (save-excursion
				   (if (dcl-backward-command)
				       (progn
					 (dcl-back-to-indentation)
					 (current-column)))))
		    (next-indent (save-excursion
				   (dcl-end-of-command)
				   (if (dcl-forward-command)
				       (progn
					 (dcl-beginning-of-command)
					 (dcl-back-to-indentation)
					 (current-column))))))
	       (or (and prev-indent	; last cmd is indented differently
			(/= (- this-indent prev-indent) 0))
		   (and next-indent
			(/= (- this-indent next-indent) 0))))))
      "dcl-basic-offset")
     ;; No more guesses.
     (t
      ""))))