/[erbot]/erbot/contrib/wtf.el
ViewVC logotype

Diff of /erbot/contrib/wtf.el

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.7 by mwolson, Fri Jul 22 05:59:40 2005 UTC revision 1.8 by mwolson, Thu Aug 11 23:11:54 2005 UTC
# Line 615  Line 615 
615      )      )
616    "Mapping of acronyms to expansions.")    "Mapping of acronyms to expansions.")
617    
618    (defun wtf-match-string-no-properties (num &optional string)
619      "Return NUMth match of STRING sans text properties."
620      (if (fboundp 'match-string-no-properties)
621          (match-string-no-properties num string)
622        (match-string num string)))
623    
624    (defun wtf-get-term-at-point ()
625      "Return the term at point."
626      (interactive)
627      (save-excursion
628        (if (re-search-backward "\\W" (point-min) t)
629            (goto-char (1+ (point)))
630          (beginning-of-line))
631        (when (looking-at "\\w+")
632          (let ((term (downcase (wtf-match-string-no-properties 0))))
633            (when (assoc (upcase term) wtf-alist)
634              term)))))
635    
636  (defun wtf-is (term)  (defun wtf-is (term)
637    "Provide the definition for TERM.    "Provide the definition for TERM.
638  When called interactively, print the message \"TERM is DEF\".  When called interactively, print the message \"TERM is DEF\".
# Line 625  DEF refers to the definition associated Line 643  DEF refers to the definition associated
643     (list (completing-read "Term: "     (list (completing-read "Term: "
644                            (mapcar #'(lambda (term)                            (mapcar #'(lambda (term)
645                                        (downcase (car term)))                                        (downcase (car term)))
646                                    wtf-alist))))                                    wtf-alist)
647                              nil t (wtf-get-term-at-point))))
648    (when (stringp term)    (when (stringp term)
649      (let ((def (cdr (assoc (upcase term) wtf-alist))))      (let ((def (cdr (assoc (upcase term) wtf-alist))))
650        (when def        (when def

Legend:
Removed from v.1.7  
changed lines
  Added in v.1.8

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26