1 |
;;; erbutils.el --- |
;;; erbutils.el --- |
2 |
;; Time-stamp: <2005-08-11 20:27:57 deego> |
;; Time-stamp: <2005-09-02 14:52:55 deego> |
3 |
;; Copyright (C) 2002,2003,2004,2005 D. Goel |
;; Copyright (C) 2002,2003,2004,2005 D. Goel |
4 |
;; Emacs Lisp Archive entry |
;; Emacs Lisp Archive entry |
5 |
;; Filename: erbutils.el |
;; Filename: erbutils.el |
236 |
(terpri) |
(terpri) |
237 |
(if (erbcompat-local-variable-p variable) |
(if (erbcompat-local-variable-p variable) |
238 |
(progn |
(progn |
239 |
(princ (format "Local in buffer %s; " (buffer-name))) |
(princ (format "Local in buffer %s; " (buffer-name))) |
240 |
;; (if (not (default-boundp variable)) |
;; (if (not (default-boundp variable)) |
241 |
;; (princ "globally void") |
;; (princ "globally void") |
242 |
;; (let ((val (default-value variable))) |
;; (let ((val (default-value variable))) |
243 |
;; (with-current-buffer standard-output |
;; (with-current-buffer standard-output |
244 |
;; (princ "global value is ") |
;; (princ "global value is ") |
245 |
;; (terpri) Fixme: pp can take an age if you happen |
;; (terpri) Fixme: pp can take an age if you happen |
246 |
;; ;; to ask for a very large |
;; ;; to ask for a very large |
247 |
;; ;; expression. We should |
;; ;; expression. We should |
248 |
;; ;; probably print it raw once |
;; ;; probably print it raw once |
249 |
;; ;; and check it's a sensible |
;; ;; and check it's a sensible |
250 |
;; ;; size before prettyprinting. |
;; ;; size before prettyprinting. |
251 |
;; ;; -- fx |
;; ;; -- fx |
252 |
;; (let ((from (point))) |
;; (let ((from (point))) |
253 |
;; (pp val) |
;; (pp val) |
254 |
;; (help-xref-on-pp from (point)) |
;; (help-xref-on-pp from (point)) |
255 |
;; (if (< (point) (+ from 20)) |
;; (if (< (point) (+ from 20)) |
256 |
;; (save-excursion |
;; (save-excursion |
257 |
;; (goto-char from) |
;; (goto-char from) |
258 |
;; (delete-char -1))))))) |
;; (delete-char -1))))))) |
259 |
(terpri))) |
(terpri))) |
260 |
(terpri) |
(terpri) |
261 |
;; (with-current-buffer standard-output |
;; (with-current-buffer standard-output |
262 |
;; (if (> (count-lines (point-min) (point-max)) 10) |
;; (if (> (count-lines (point-min) (point-max)) 10) |
277 |
;; (princ "Documentation:") |
;; (princ "Documentation:") |
278 |
(terpri) |
(terpri) |
279 |
(let ((doc |
(let ((doc |
280 |
(documentation-property variable 'variable-documentation))) |
(documentation-property variable 'variable-documentation))) |
281 |
(princ (or doc "not documented as a variable."))) |
(princ (or doc "not documented as a variable."))) |
282 |
(help-setup-xref (list #'describe-variable variable (current-buffer)) |
(help-setup-xref (list #'describe-variable variable (current-buffer)) |
283 |
(interactive-p)) |
(interactive-p)) |
284 |
|
|
285 |
;; Make a link to customize if this variable can be customized. |
;; Make a link to customize if this variable can be customized. |
286 |
;; Note, it is not reliable to test only for a custom-type property |
;; Note, it is not reliable to test only for a custom-type property |
287 |
;; because those are only present after the var's definition |
;; because those are only present after the var's definition |
288 |
;; has been loaded. |
;; has been loaded. |
289 |
(if (or (get variable 'custom-type) ; after defcustom |
(if (or (get variable 'custom-type) ; after defcustom |
290 |
(get variable 'custom-loads) ; from loaddefs.el |
(get variable 'custom-loads) ; from loaddefs.el |
291 |
(get variable 'standard-value)) ; from cus-start.el |
(get variable 'standard-value)) ; from cus-start.el |
292 |
(let ((customize-label "customize")) |
(let ((customize-label "customize")) |
293 |
(terpri) |
(terpri) |
294 |
(terpri) |
(terpri) |
295 |
(princ (concat "You can " customize-label " this variable.")) |
(princ (concat "You can " customize-label " this variable.")) |
296 |
(with-current-buffer "*Help*" |
(with-current-buffer "*Help*" |
297 |
(save-excursion |
(save-excursion |
298 |
(re-search-backward |
(re-search-backward |
299 |
(concat "\\(" customize-label "\\)") nil t) |
(concat "\\(" customize-label "\\)") nil t) |
300 |
(help-xref-button 1 (lambda (v) |
(help-xref-button 1 (lambda (v) |
301 |
(if help-xref-stack |
(if help-xref-stack |
302 |
(pop help-xref-stack)) |
(pop help-xref-stack)) |
303 |
(customize-variable v)) |
(customize-variable v)) |
304 |
variable |
variable |
305 |
"mouse-2, RET: customize variable"))))) |
"mouse-2, RET: customize variable"))))) |
306 |
;; Make a hyperlink to the library if appropriate. (Don't |
;; Make a hyperlink to the library if appropriate. (Don't |
307 |
;; change the format of the buffer's initial line in case |
;; change the format of the buffer's initial line in case |
308 |
;; anything expects the current format.) |
;; anything expects the current format.) |
326 |
(save-excursion |
(save-excursion |
327 |
(set-buffer standard-output) |
(set-buffer standard-output) |
328 |
;; Return the text we displayed. |
;; Return the text we displayed. |
329 |
(buffer-string))))))) |
(buffer-substring-no-properties (point-min) (point-max)))))))) |
330 |
|
|
331 |
|
|
332 |
|
|
333 |
|
|
334 |
(defvar erbutils-itemize-style |
(defvar erbutils-itemize-style |
384 |
(if (stringp (sexp-at-point)) |
(if (stringp (sexp-at-point)) |
385 |
;; this sets mark.. bad programming, i know.. |
;; this sets mark.. bad programming, i know.. |
386 |
(backward-kill-sexp 1)) |
(backward-kill-sexp 1)) |
387 |
(buffer-string))) |
(erbutils-buffer-string))) |
388 |
(erbutils-single-lines newdoc))) |
(erbutils-single-lines newdoc))) |
389 |
|
|
390 |
(defun erbutils-single-lines (str) |
(defun erbutils-single-lines (str) |
635 |
(and |
(and |
636 |
(stringp str) |
(stringp str) |
637 |
(not (string= str "")) |
(not (string= str "")) |
638 |
(setq expr (read (concat " ( " str " )")))))) |
(setq expr (erbn-read (concat " ( " str " )")))))) |
639 |
|
|
640 |
|
|
641 |
(defun erbutils-functions-in-file (file) |
(defun erbutils-functions-in-file (file) |
646 |
(and |
(and |
647 |
(stringp str) |
(stringp str) |
648 |
(not (string= str "")) |
(not (string= str "")) |
649 |
(setq expr (read (concat " ( " str " )"))) |
(setq expr (erbn-read (concat " ( " str " )"))) |
650 |
(ignore-errors (mapcar 'second expr))))) |
(ignore-errors (mapcar 'second expr))))) |
651 |
|
|
652 |
|
|
690 |
|
|
691 |
|
|
692 |
|
|
693 |
|
|
694 |
|
(defun erbutils-remove-text--properties (str) |
695 |
|
(let (str2) |
696 |
|
(cond |
697 |
|
((stringp str) |
698 |
|
(setq str2 (copy-sequence str)) |
699 |
|
(set-text-properties 0 (length str2) nil str2) |
700 |
|
str2) |
701 |
|
(t (error "Not a string."))))) |
702 |
|
|
703 |
|
|
704 |
|
|
705 |
|
|
706 |
|
(defun erbutils-remove-text-properties-maybe (str) |
707 |
|
(if (stringp str) |
708 |
|
(erbutils-remove-text-properties str) |
709 |
|
str)) |
710 |
|
|
711 |
|
|
712 |
|
(defun erbutils-buffer-string () |
713 |
|
(buffer-substring-no-properties (point-min) (point-max))) |
714 |
|
|
715 |
;;; erbutils.el ends here |
;;; erbutils.el ends here |