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\". |
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 |