unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Debugging abbrev-file
@ 2006-06-13 12:30 Andreas Roehler
  0 siblings, 0 replies; 2+ messages in thread
From: Andreas Roehler @ 2006-06-13 12:30 UTC (permalink / raw)


;; 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))
  (save-excursion
    (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 a.roehler@web.de changed section start
          (message "%s" (point))
          ;; 2006-06-13 a.roehler@web.de changed section end      
          (setq abbrevs (cons (list name exp hook count sys) abbrevs)))
        (define-abbrev-table table abbrevs)))))

__
Andreas Roehler

^ permalink raw reply	[flat|nested] 2+ messages in thread
* Debugging abbrev-file
@ 2006-06-13 12:30 Andreas Roehler
  0 siblings, 0 replies; 2+ messages in thread
From: Andreas Roehler @ 2006-06-13 12:30 UTC (permalink / raw)


;; 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))
  (save-excursion
    (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 a.roehler@web.de changed section start
          (message "%s" (point))
          ;; 2006-06-13 a.roehler@web.de changed section end      
          (setq abbrevs (cons (list name exp hook count sys) abbrevs)))
        (define-abbrev-table table abbrevs)))))

__
Andreas Roehler

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2006-06-13 12:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-06-13 12:30 Debugging abbrev-file Andreas Roehler
  -- strict thread matches above, loose matches on Subject: below --
2006-06-13 12:30 Andreas Roehler

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).