gnu-emacs-sources
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

where-am-i


From: Thien-Thi Nguyen
Subject: where-am-i
Date: Sun, 01 Jul 2007 16:38:56 +0200

greetings earthlings,

do not fear the deep nesting,
may crumbs path your labyrinth!
thought laid down for testing,
naught for shared: o keyboard synth!

thi


_______________________________________________________________________
(require 'cl)
(defun where-am-i ()
  "Summarize in the echo area the forms surrounding point.
See also variable `max-mini-window-height'."
  (interactive)
  (flet ((line () (buffer-substring
                   (line-beginning-position)
                   (1+ (line-end-position)))))
    (let ((acc (list (line) (concat
                             ;; Use text properties instead of
                             ;; `make-string' to be upward compatible
                             ;; w/ a hopefully not-too-distant future
                             ;; float-returning `current-column'.
                             (propertize
                              " " 'display
                              `(space :align-to ,(current-column)))
                             "^"))))
      (save-excursion
        (while (ignore-errors
                 (while (memq (get-text-property (point) 'face)
                              '(font-lock-comment-face
                                font-lock-comment-delimiter-face
                                font-lock-string-face))
                   (forward-char -1))
                 (backward-up-list)
                 (pushnew (line) acc :test 'string=))))
      (message "%s" (apply 'concat acc)))))




reply via email to

[Prev in Thread] Current Thread [Next in Thread]