Function: viper-brac-function

viper-brac-function is an interactive and byte-compiled function defined in viper-cmd.el.gz.

Signature

(viper-brac-function ARG)

Documentation

Function called by [, the brac. View textmarkers and call [[.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/emulation/viper-cmd.el.gz
(defun viper-brac-function (arg)
  "Function called by [, the brac.  View textmarkers and call [[."
  (interactive "P")
  (let ((reg (read-char)))
    (cond ((viper= ?\[ reg)
	   (viper-prev-heading arg))
	  ((viper= ?\] reg)
	   (viper-heading-end arg))
	  ((viper-valid-register reg '(letter))
	   (let* ((val (get-register (1+ (- reg ?a))))
		  (buf (if (not (markerp val))
			   (error viper-EmptyTextmarker reg)
			 (marker-buffer val)))
		  (pos (marker-position val))
		  line-no text (s pos) (e pos))
	     (with-output-to-temp-buffer " *viper-info*"
	       (if (and buf pos)
		   (progn
		     (with-current-buffer buf
		       (setq line-no (1+ (count-lines (point-min) val)))
		       (goto-char pos)
		       (beginning-of-line)
		       (if (re-search-backward "[^ \t]" nil t)
                           (setq s (line-beginning-position)))
		       (goto-char pos)
		       (forward-line 1)
		       (if (re-search-forward "[^ \t]" nil t)
			   (progn
			     (end-of-line)
			     (setq e (point))))
		       (setq text (buffer-substring s e))
		       (setq text (format "%s<%c>%s"
					  (substring text 0 (- pos s))
					  reg (substring text (- pos s)))))
		     (princ
		      (format-message
		       "Textmarker `%c' is in buffer `%s' at line %d.\n"
				     reg (buffer-name buf) line-no))
		     (princ (format "Here is some text around %c:\n\n %s"
				     reg text)))
		 (princ (format-message viper-EmptyTextmarker reg))))
	     ))
	  (t (error viper-InvalidTextmarker reg)))))