Function: table--probe-cell-left-up

table--probe-cell-left-up is a byte-compiled function defined in table.el.gz.

Signature

(table--probe-cell-left-up)

Documentation

Probe left up corner pattern of a cell.

If it finds a valid corner returns a position otherwise returns nil. The position is the location before the first cell character. Focus only on the corner pattern. Further cell validity check is required.

Source Code

;; Defined in /usr/src/emacs/lisp/textmodes/table.el.gz
(defun table--probe-cell-left-up ()
  "Probe left up corner pattern of a cell.
If it finds a valid corner returns a position otherwise returns nil.
The position is the location before the first cell character.
Focus only on the corner pattern.  Further cell validity check is required."
  (save-excursion
    (let ((vertical-str (regexp-quote (char-to-string table-cell-vertical-char)))
	  (intersection-str (regexp-quote (char-to-string table-cell-intersection-char)))
	  (v-border (format "[%c%c]" table-cell-vertical-char table-cell-intersection-char))
	  (h-border (format "[%s%c]" table-cell-horizontal-chars table-cell-intersection-char))
	  (limit (line-beginning-position)))
      (catch 'end
	(while t
	  (catch 'retry-horizontal
	    (if (not (search-backward-regexp v-border limit t))
		(throw 'end nil))
	    (save-excursion
	      (let ((column (current-column)))
		(while t
		  (catch 'retry-vertical
		    (if (zerop (forward-line -1)) nil (throw 'end nil))
		    (move-to-column column)
		    (while (and (looking-at vertical-str)
				(= column (current-column)))
		      (if (zerop (forward-line -1)) nil (throw 'end nil))
		      (move-to-column column))
		    (cond
		     ((/= column (current-column))
		      (throw 'end nil))
		     ((looking-at (concat intersection-str h-border))
		      (forward-line 1)
		      (move-to-column column)
		      (forward-char 1)
		      (throw 'end (point)))
		     ((looking-at intersection-str)
		      (throw 'retry-vertical nil))
		     (t (throw 'retry-horizontal nil)))))))))))))