Function: tcl-electric-hash

tcl-electric-hash is an interactive and byte-compiled function defined in tcl.el.gz.

Signature

(tcl-electric-hash &optional COUNT)

Documentation

Insert a # and quote if it does not start a real comment.

Prefix arg is number of #s to insert. See variable tcl-electric-hash-style for description of quoting styles.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/tcl.el.gz
(defun tcl-electric-hash (&optional count)
  "Insert a `#' and quote if it does not start a real comment.
Prefix arg is number of `#'s to insert.
See variable `tcl-electric-hash-style' for description of quoting
styles."
  (interactive "p")
  (or count (setq count 1))
  (if (> count 0)
      (let ((type
	     (if (eq tcl-electric-hash-style 'smart)
		 (if (> count 3)	; FIXME what is "smart"?
		     'quote
		   'backslash)
	       tcl-electric-hash-style))
	    comment)
	(if type
	    (progn
	      (save-excursion
		(insert "#")
		(setq comment (tcl-in-comment)))
	      (delete-char 1)
	      (and tcl-explain-indentation (message "comment: %s" comment))
	      (cond
	       ((eq type 'quote)
		(if (not comment)
		    (insert "\"")))
	       ((eq type 'backslash)
		;; The following will set count to 0, so the
		;; insert-char can still be run.
		(if (not comment)
		    (while (> count 0)
		      (insert "\\#")
		      (setq count (1- count)))))
	       (t nil))))
	(insert-char ?# count))))