[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
pars-part-output.el
From: |
Andreas Roehler |
Subject: |
pars-part-output.el |
Date: |
Mon, 19 Feb 2007 19:37:38 +0100 |
User-agent: |
KNode/0.9.2 |
;;; Displays result of `parse-partial-sexp' together with the explanation
;; from its docstring
;; Copyright (C) 2007 Andreas Roehler
;; Author: Andreas Roehler <address@hidden>
;; Keywords: tools, lisp
;; This file is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 2, or (at your option)
;; any later version.
;; This file is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING. If not, write to
;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
;; Boston, MA 02110-1301, USA.
;;; Commentary:
;; In contrast to `parse-partial-sexp' treatment of
;; `syntax-ppss' that way probably isn't useful due to
;; the nature of this function. As it does no harm, I
;; still keep it here for the moment.
;; Anyone else interested in such things? Maybe its
;; already available? Other known tools of
;; that kind?
;; (global-set-key (kbd "<M-f6>") 'parse-partial-sexp-iac)
;; (global-set-key (kbd "<M-f7>") 'syntax-ppss-iac)
(defun parse-partial-sexp-iac ()
"Interactive form of parse-partial-sexp
output listed with documentation"
(interactive)
(ppse-documented-base 'parse-partial-sexp (point)))
(defun syntax-ppss-iac ()
"Syntax-ppss made interactive output listed with documentation"
(interactive)
(ppse-documented-base 'syntax-ppss (point)))
(defun ppse-documented-base (funktion pos)
"Parse partial symbolic expression
list results below its documentation "
(let* ((start (progn (beginning-of-defun) (point)))
(end pos)
(rekord
(if
(eq this-command 'parse-partial-sexp-iac)
(with-syntax-table (standard-syntax-table) (funcall funktion
start end))
(with-syntax-table (standard-syntax-table) (funcall funktion end))))
(doku (documentation 'parse-partial-sexp))
(doku-abr (list (substring doku (1+ (string-match ":" doku))))))
(message "%s" rekord)
(with-output-to-temp-buffer (concat (format "%s" funktion) "-output")
(set-buffer standard-output)
(insert (car doku-abr))
(goto-char (point-min))
(re-search-forward "^ [0-9]+\." nil t 1)
(replace-match "-")
(forward-line 1)
(split-line)
(dolist (elt rekord)
(insert (format "\t ====> %s <====" elt))
(re-search-forward "^ [0-9]+\." nil t 1)
(replace-match "-")
(end-of-line)
(newline))))
(goto-char (point-min))
(toggle-read-only -1)
(set-window-text-height (selected-window) 4)
(while (not (eobp))
(if (looking-at "^[ \t]*$")
(delete-region (point) (progn (forward-line) (point)))
(forward-line))))
(provide 'pars-part-output)
;;; pars-part-output.el ends here
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- pars-part-output.el,
Andreas Roehler <=