[Top][All Lists]

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

Debugging abbrev-file

From: Andreas Roehler
Subject: Debugging abbrev-file
Date: Tue, 13 Jun 2006 14:30:24 +0200
User-agent: KNode/0.9.2

;; Debugging abbrev-files turned out to be hairy
;;  sometimes.  As `define-abbrevs' stops while
;;  encountering an error, this function permits to
;;  jump just at the last messaged cursor position.

;; Probably there are more efficient ways to debug such
;; a file.  Please send your comments, alternatives
;; etc.

(defun define-abbrevs-localise (&optional arg)
  "As `define-abbrevs.' Messages `point' while processing
current visible buffer contents.
See documentation of `edit-abbrevs' for info on the format of the
text you must have in the buffer.
With argument, eliminate all abbrev definitions except
the ones defined from the buffer now."
  (interactive "P")
  (if arg (kill-all-abbrevs))
    (goto-char (point-min))
    (while (and (not (eobp)) (re-search-forward "^(" nil t))
      (let* ((buf (current-buffer))
             (table (read buf))
             abbrevs name hook exp count sys)
        (forward-line 1)
        (while (progn (forward-line 1)
                      (not (eolp)))
          (setq name (read buf) count (read buf))
          (if (equal count '(sys))
              (setq sys t count (read buf)))
          (setq exp (read buf))
          (skip-chars-backward " \t\n\f")
          (setq hook (if (not (eolp)) (read buf)))
          (skip-chars-backward " \t\n\f")
          ;; 2006-06-13 changed section start
          (message "%s" (point))
          ;; 2006-06-13 changed section end      
          (setq abbrevs (cons (list name exp hook count sys) abbrevs)))
        (define-abbrev-table table abbrevs)))))

Andreas Roehler

reply via email to

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