1 |
;;; erbc.el --- Erbot user-interface commands. |
;;; erbc.el --- Erbot user-interface commands. |
2 |
;; Time-stamp: <2005-01-08 00:16:38 deego> |
;; Time-stamp: <2005-01-08 12:52:26 deego> |
3 |
;; Copyright (C) 2002 D. Goel |
;; Copyright (C) 2002 D. Goel |
4 |
;; Emacs Lisp Archive entry |
;; Emacs Lisp Archive entry |
5 |
;; Filename: erbc.el |
;; Filename: erbc.el |
87 |
|
|
88 |
|
|
89 |
|
|
90 |
(defcustom erbnoc-char "," |
(defcustom erbn-char "," |
91 |
"The character which calls the bot. |
"The character which calls the bot. |
92 |
|
|
93 |
in addition to directly addressing it. |
in addition to directly addressing it. |
97 |
|
|
98 |
Is really a string, but the length of the string should be 1,. |
Is really a string, but the length of the string should be 1,. |
99 |
") |
") |
100 |
(defcustom erbnoc-char-double (concat erbnoc-char erbnoc-char) |
(defcustom erbn-char-double (concat erbn-char erbn-char) |
101 |
"The string which calls the bot from midsentence |
"The string which calls the bot from midsentence |
102 |
|
|
103 |
this string should have a length of EXACTLY 2. |
this string should have a length of EXACTLY 2. |
116 |
|
|
117 |
|
|
118 |
(defvar fs-tgt "Tgt visible to the end-user, as well as changeable by them.") |
(defvar fs-tgt "Tgt visible to the end-user, as well as changeable by them.") |
119 |
(defvar erbnoc-tgt "Tgt visible to the end-user, but NOT changeable by them.") |
(defvar erbn-tgt "Tgt visible to the end-user, but NOT changeable by them.") |
120 |
|
|
121 |
(defvar fs-nick "") |
(defvar fs-nick "") |
122 |
(defvar erbnoc-nick "") |
(defvar erbn-nick "") |
123 |
|
|
124 |
(defvar erbnoc-buffer "") |
(defvar erbn-buffer "") |
125 |
|
|
126 |
(defcustom fs-internal-parse-error-p |
(defcustom fs-internal-parse-error-p |
127 |
nil |
nil |
133 |
lisp hackers, we will want to make this t for users' convenience.") |
lisp hackers, we will want to make this t for users' convenience.") |
134 |
|
|
135 |
|
|
136 |
(defcustom erbnoc-shell-command-p nil |
(defcustom erbn-shell-command-p nil |
137 |
"Whether to allow commands that use shell-commands... |
"Whether to allow commands that use shell-commands... |
138 |
Some fsbot commands use shell-commands... shell-commands always mean |
Some fsbot commands use shell-commands... shell-commands always mean |
139 |
possibility of exploits. andn are disabled by default. |
possibility of exploits. andn are disabled by default. |
150 |
"" |
"" |
151 |
:group 'erbc) |
:group 'erbc) |
152 |
|
|
153 |
(defcustom erbnoc-google-defaults |
(defcustom erbn-google-defaults |
154 |
'(("#emacs" ("emacs")) |
'(("#emacs" ("emacs")) |
155 |
("#fsbot" ("fsbot"))) |
("#fsbot" ("fsbot"))) |
156 |
"" :group 'erbc) |
"" :group 'erbc) |
157 |
|
|
158 |
|
|
159 |
|
|
160 |
(defun erbnoc-shell-command (&optional command overridep) |
(defun erbn-shell-command (&optional command overridep) |
161 |
"Execute shell-commands when erbnoc-shell-command-p is true. |
"Execute shell-commands when erbn-shell-command-p is true. |
162 |
|
|
163 |
However, if the second argument overridep is non-nil, we use that to |
However, if the second argument overridep is non-nil, we use that to |
164 |
determine whether to execute the command. In that case, we execute |
determine whether to execute the command. In that case, we execute |
168 |
((or (and overridep |
((or (and overridep |
169 |
(listp overridep) |
(listp overridep) |
170 |
(first overridep)) |
(first overridep)) |
171 |
erbnoc-shell-command-p) |
erbn-shell-command-p) |
172 |
(apply 'shell-command command nil)) |
(apply 'shell-command command nil)) |
173 |
(t |
(t |
174 |
(error "The bot-operator has shell commands disabled")))) |
(error "The bot-operator has shell commands disabled")))) |
177 |
|
|
178 |
|
|
179 |
|
|
180 |
(defun erbnoc-shell-command-to-string (&optional command overridep) |
(defun erbn-shell-command-to-string (&optional command overridep) |
181 |
"Execute shell-commands when erbnoc-shell-command-p is true. |
"Execute shell-commands when erbn-shell-command-p is true. |
182 |
|
|
183 |
However, if the second argument overridep is non-nil, we use that to |
However, if the second argument overridep is non-nil, we use that to |
184 |
determine whether to execute the command. In that case, we execute |
determine whether to execute the command. In that case, we execute |
188 |
((or (and overridep |
((or (and overridep |
189 |
(listp overridep) |
(listp overridep) |
190 |
(first overridep)) |
(first overridep)) |
191 |
erbnoc-shell-command-p) |
erbn-shell-command-p) |
192 |
(apply 'shell-command-to-string command nil)) |
(apply 'shell-command-to-string command nil)) |
193 |
(t |
(t |
194 |
(error "The bot-operator has shell commands disabled")))) |
(error "The bot-operator has shell commands disabled")))) |
198 |
|
|
199 |
|
|
200 |
(defun fsi-get-google-defaults () |
(defun fsi-get-google-defaults () |
201 |
(cadr (assoc fs-tgt erbnoc-google-defaults))) |
(cadr (assoc fs-tgt erbn-google-defaults))) |
202 |
|
|
203 |
(defvar fs-prestring "") |
(defvar fs-prestring "") |
204 |
;; (make-variable-buffer-local 'fs-prestring) |
;; (make-variable-buffer-local 'fs-prestring) |
594 |
(unless (stringp origmsg) |
(unless (stringp origmsg) |
595 |
(setq origmsg (format "%s" origmsg))) |
(setq origmsg (format "%s" origmsg))) |
596 |
(unless msg |
(unless msg |
597 |
(error "Format: %s (parse \"your-english-message\")" erbnoc-char)) |
(error "Format: %s (parse \"your-english-message\")" erbn-char)) |
598 |
(unless (stringp msg) |
(unless (stringp msg) |
599 |
(setq msg (format "%s" msg))) |
(setq msg (format "%s" msg))) |
600 |
;; remove leading spaces.. |
;; remove leading spaces.. |
636 |
;;(or |
;;(or |
637 |
;;(string-match |
;;(string-match |
638 |
;;erbot-nick msg) |
;;erbot-nick msg) |
639 |
;;(string-match (concat "^" erbnoc-char) msg) |
;;(string-match (concat "^" erbn-char) msg) |
640 |
;;(string-match erbnoc-char-double msg)) |
;;(string-match erbn-char-double msg)) |
641 |
) |
) |
642 |
(setq founddoublequery t) |
(setq founddoublequery t) |
643 |
(setq msg (concat erbnoc-char " (m8b)"))))) |
(setq msg (concat erbn-char " (m8b)"))))) |
644 |
|
|
645 |
(when (and (stringp msg) |
(when (and (stringp msg) |
646 |
(> (length msg) 0) |
(> (length msg) 0) |
671 |
(let (pos) |
(let (pos) |
672 |
(when |
(when |
673 |
(and (not (equal 0 |
(and (not (equal 0 |
674 |
(string-match erbnoc-char msg))) |
(string-match erbn-char msg))) |
675 |
(not |
(not |
676 |
(let ((nickpos (string-match erbot-nick msg))) |
(let ((nickpos (string-match erbot-nick msg))) |
677 |
(and nickpos |
(and nickpos |
678 |
(< nickpos 3)))) |
(< nickpos 3)))) |
679 |
;; part of and |
;; part of and |
680 |
(setq pos |
(setq pos |
681 |
(string-match erbnoc-char-double msg))) |
(string-match erbn-char-double msg))) |
682 |
(setq msg (substring msg (+ pos 1))) |
(setq msg (substring msg (+ pos 1))) |
683 |
(when (setq pos (string-match erbnoc-char-double msg)) |
(when (setq pos (string-match erbn-char-double msg)) |
684 |
(setq msg (substring msg 0 pos))))) |
(setq msg (substring msg 0 pos))))) |
685 |
|
|
686 |
; deal with the leading , or ,, |
; deal with the leading , or ,, |
687 |
(when (equal 0 |
(when (equal 0 |
688 |
(string-match erbnoc-char msg)) |
(string-match erbn-char msg)) |
689 |
(let ((restmsg (substring msg 1))) |
(let ((restmsg (substring msg 1))) |
690 |
(when (equal 0 (string-match "," restmsg)) |
(when (equal 0 (string-match "," restmsg)) |
691 |
(setq restmsg (substring restmsg 1))) |
(setq restmsg (substring restmsg 1))) |
887 |
(cond |
(cond |
888 |
|
|
889 |
;; are in a read mode.. |
;; are in a read mode.. |
890 |
(erbnoc-read-mode |
(erbn-read-mode |
891 |
(fs-botread-feed-internal msgstr)) |
(fs-botread-feed-internal msgstr)) |
892 |
;; already in lisp form... just need to sandbox.. |
;; already in lisp form... just need to sandbox.. |
893 |
((and lispmsg |
((and lispmsg |
1152 |
(eval |
(eval |
1153 |
(erbutils-random |
(erbutils-random |
1154 |
'( |
'( |
1155 |
(concat aa erbnoc-char " " fs-nick) |
(concat aa erbn-char " " fs-nick) |
1156 |
(concat fs-nick erbnoc-char " " aa)))))) |
(concat fs-nick erbn-char " " aa)))))) |
1157 |
|
|
1158 |
(defun fs-greet (&optional nick &rest args) |
(defun fs-greet (&optional nick &rest args) |
1159 |
". |
". |
1380 |
|
|
1381 |
(defun fsi-command-list (&rest foo) |
(defun fsi-command-list (&rest foo) |
1382 |
"Used by erbc.el and by erbot-install.. " |
"Used by erbc.el and by erbot-install.. " |
1383 |
(erbnoc-command-list-from-prefix "fs-")) |
(erbn-command-list-from-prefix "fs-")) |
1384 |
|
|
1385 |
|
|
1386 |
(defun fsi-command-list-readonly (&rest foo) |
(defun fsi-command-list-readonly (&rest foo) |
1387 |
"Used by erbc.el.. and erbot-install " |
"Used by erbc.el.. and erbot-install " |
1388 |
(erbnoc-command-list-from-prefix "fsi-")) |
(erbn-command-list-from-prefix "fsi-")) |
1389 |
|
|
1390 |
|
|
1391 |
(defun erbnoc-command-list-from-prefix (prefix &rest foo) |
(defun erbn-command-list-from-prefix (prefix &rest foo) |
1392 |
"Used by erbc.el.. should return a string.." |
"Used by erbc.el.. should return a string.." |
1393 |
(let* |
(let* |
1394 |
((longnames (erbutils-matching-functions prefix)) |
((longnames (erbutils-matching-functions prefix)) |
1577 |
))))) |
))))) |
1578 |
|
|
1579 |
|
|
1580 |
(defcustom erbnoc-greeting-string |
(defcustom erbn-greeting-string |
1581 |
"Greetings and Salutations from %s" "") |
"Greetings and Salutations from %s" "") |
1582 |
|
|
1583 |
|
|
1605 |
(string-match erbot-nick (first exprlist)))) |
(string-match erbot-nick (first exprlist)))) |
1606 |
(setq gotit t |
(setq gotit t |
1607 |
ans |
ans |
1608 |
(format erbnoc-greeting-string |
(format erbn-greeting-string |
1609 |
erbot-nick))) |
erbot-nick))) |
1610 |
((or |
((or |
1611 |
(member "hi" exprlist) |
(member "hi" exprlist) |
2046 |
)) |
)) |
2047 |
((and expandp (member cc '("lisp"))) |
((and expandp (member cc '("lisp"))) |
2048 |
(erbeng-main |
(erbeng-main |
2049 |
(concat erbnoc-char " (progn " |
(concat erbn-char " (progn " |
2050 |
(substring aa |
(substring aa |
2051 |
(with-temp-buffer |
(with-temp-buffer |
2052 |
(insert aa) |
(insert aa) |
2457 |
(apply 'fs-set-term args)))) |
(apply 'fs-set-term args)))) |
2458 |
|
|
2459 |
|
|
2460 |
(defcustom erbnoc-fortune-p t |
(defcustom erbn-fortune-p t |
2461 |
"This is true by default.. since (shell-command \"fortune\") is not |
"This is true by default.. since (shell-command \"fortune\") is not |
2462 |
risky.. ") |
risky.. ") |
2463 |
|
|
2464 |
|
|
2465 |
(defun erbnoc-fortune (arg) |
(defun erbn-fortune (arg) |
2466 |
(unless arg (setq arg "")) |
(unless arg (setq arg "")) |
2467 |
(cond |
(cond |
2468 |
((string= arg "") |
((string= arg "") |
2469 |
(erbutils-eval-until-limited |
(erbutils-eval-until-limited |
2470 |
'(erbnoc-shell-command-to-string (concat "fortune " arg) |
'(erbn-shell-command-to-string (concat "fortune " arg) |
2471 |
(list erbnoc-fortune-p) |
(list erbn-fortune-p) |
2472 |
))) |
))) |
2473 |
(t |
(t |
2474 |
(erbnoc-shell-command-to-string (concat "fortune " arg) |
(erbn-shell-command-to-string (concat "fortune " arg) |
2475 |
(list erbnoc-fortune-p) |
(list erbn-fortune-p) |
2476 |
)))) |
)))) |
2477 |
|
|
2478 |
|
|
2479 |
(defun fsi-fortune (&rest args) |
(defun fsi-fortune (&rest args) |
2480 |
(erbnoc-fortune "")) |
(erbn-fortune "")) |
2481 |
|
|
2482 |
|
|
2483 |
(defalias 'fs-f 'fs-fortune) |
(defalias 'fs-f 'fs-fortune) |
2491 |
|
|
2492 |
|
|
2493 |
(defun fs-f-f (&rest args) |
(defun fs-f-f (&rest args) |
2494 |
(erbnoc-fortune "-f")) |
(erbn-fortune "-f")) |
2495 |
|
|
2496 |
(defun fs-f-off (&rest args) |
(defun fs-f-off (&rest args) |
2497 |
(erbnoc-fortune "-o")) |
(erbn-fortune "-o")) |
2498 |
(defalias 'fs-f-o 'fs-f-off) |
(defalias 'fs-f-o 'fs-f-off) |
2499 |
(defalias 'fs-f-offensive 'fs-f-off) |
(defalias 'fs-f-offensive 'fs-f-off) |
2500 |
|
|
2501 |
|
|
2502 |
(defun fs-f-debian-hints (&rest args) |
(defun fs-f-debian-hints (&rest args) |
2503 |
(erbnoc-fortune "debian-hints")) |
(erbn-fortune "debian-hints")) |
2504 |
(defalias 'fs-debian-hints 'fs-f-debian-hints) |
(defalias 'fs-debian-hints 'fs-f-debian-hints) |
2505 |
|
|
2506 |
|
|
2507 |
|
|
2508 |
(defun fs-f-twisted-quotes (&rest args) |
(defun fs-f-twisted-quotes (&rest args) |
2509 |
(erbnoc-fortune "twisted-quotes")) |
(erbn-fortune "twisted-quotes")) |
2510 |
(defalias 'fs-quotes 'fs-f-twisted-quotes) |
(defalias 'fs-quotes 'fs-f-twisted-quotes) |
2511 |
(defalias 'fs-f-quotes 'fs-f-twisted-quotes) |
(defalias 'fs-f-quotes 'fs-f-twisted-quotes) |
2512 |
|
|
2513 |
(defun fs-f-literature (&rest args) |
(defun fs-f-literature (&rest args) |
2514 |
(erbnoc-fortune "literature")) |
(erbn-fortune "literature")) |
2515 |
(defalias 'fs-f-lit 'fs-f-literature) |
(defalias 'fs-f-lit 'fs-f-literature) |
2516 |
(defalias 'fs-lit 'fs-f-literature) |
(defalias 'fs-lit 'fs-f-literature) |
2517 |
(defalias 'fs-literature 'fs-f-literature) |
(defalias 'fs-literature 'fs-f-literature) |
2519 |
|
|
2520 |
|
|
2521 |
(defun fs-f-riddles(&rest args) |
(defun fs-f-riddles(&rest args) |
2522 |
(erbnoc-fortune "riddles")) |
(erbn-fortune "riddles")) |
2523 |
(defalias 'fs-riddle 'fs-f-riddles) |
(defalias 'fs-riddle 'fs-f-riddles) |
2524 |
|
|
2525 |
|
|
2526 |
|
|
2527 |
(defun fs-f-art (&rest args) |
(defun fs-f-art (&rest args) |
2528 |
(erbnoc-fortune "art")) |
(erbn-fortune "art")) |
2529 |
(defalias 'fs-art 'fs-f-art) |
(defalias 'fs-art 'fs-f-art) |
2530 |
|
|
2531 |
|
|
2532 |
|
|
2533 |
|
|
2534 |
(defun fs-f-bofh-excuses (&rest args) |
(defun fs-f-bofh-excuses (&rest args) |
2535 |
(erbnoc-fortune "bofh-excuses")) |
(erbn-fortune "bofh-excuses")) |
2536 |
(defalias 'fs-bofh 'fs-f-bofh-excuses) |
(defalias 'fs-bofh 'fs-f-bofh-excuses) |
2537 |
|
|
2538 |
|
|
2539 |
|
|
2540 |
|
|
2541 |
(defun fs-f-ascii-art (&rest args) |
(defun fs-f-ascii-art (&rest args) |
2542 |
(erbnoc-fortune "ascii-art")) |
(erbn-fortune "ascii-art")) |
2543 |
(defalias 'fs-ascii 'fs-f-ascii-art) |
(defalias 'fs-ascii 'fs-f-ascii-art) |
2544 |
|
|
2545 |
|
|
2546 |
|
|
2547 |
|
|
2548 |
(defun fs-f-computers (&rest args) |
(defun fs-f-computers (&rest args) |
2549 |
(erbnoc-fortune "computers")) |
(erbn-fortune "computers")) |
2550 |
|
|
2551 |
(defalias 'fs-f-computer 'fs-f-computers) |
(defalias 'fs-f-computer 'fs-f-computers) |
2552 |
|
|
2555 |
|
|
2556 |
|
|
2557 |
(defun fs-f-cookies (&rest args) |
(defun fs-f-cookies (&rest args) |
2558 |
(erbnoc-fortune "cookies")) |
(erbn-fortune "cookies")) |
2559 |
|
|
2560 |
(defalias 'fs-f-cookie 'fs-f-cookies) |
(defalias 'fs-f-cookie 'fs-f-cookies) |
2561 |
(defalias 'fs-cookie 'fs-f-cookies) |
(defalias 'fs-cookie 'fs-f-cookies) |
2569 |
|
|
2570 |
|
|
2571 |
(defun fs-f-definitions (&rest args) |
(defun fs-f-definitions (&rest args) |
2572 |
(erbnoc-fortune "definitions")) |
(erbn-fortune "definitions")) |
2573 |
|
|
2574 |
(defalias 'fs-def 'fs-f-defintions) |
(defalias 'fs-def 'fs-f-defintions) |
2575 |
|
|
2577 |
|
|
2578 |
|
|
2579 |
(defun fs-f-drugs (&rest args) |
(defun fs-f-drugs (&rest args) |
2580 |
(erbnoc-fortune "drugs")) |
(erbn-fortune "drugs")) |
2581 |
(defalias 'fs-drugs 'fs-f-drugs) |
(defalias 'fs-drugs 'fs-f-drugs) |
2582 |
(defalias 'fs-drug 'fs-f-drugs) |
(defalias 'fs-drug 'fs-f-drugs) |
2583 |
|
|
2585 |
|
|
2586 |
|
|
2587 |
(defun fs-f-education (&rest args) |
(defun fs-f-education (&rest args) |
2588 |
(erbnoc-fortune "education")) |
(erbn-fortune "education")) |
2589 |
|
|
2590 |
|
|
2591 |
(defun fs-f-ethnic (&rest args) |
(defun fs-f-ethnic (&rest args) |
2592 |
(erbnoc-fortune "ethnic")) |
(erbn-fortune "ethnic")) |
2593 |
|
|
2594 |
|
|
2595 |
|
|
2596 |
|
|
2597 |
(defun fs-f-food (&rest args) |
(defun fs-f-food (&rest args) |
2598 |
(erbnoc-fortune "food")) |
(erbn-fortune "food")) |
2599 |
(defalias 'fs-food 'fs-f-food) |
(defalias 'fs-food 'fs-f-food) |
2600 |
|
|
2601 |
|
|
2604 |
|
|
2605 |
|
|
2606 |
(defun fs-f-goedel (&rest args) |
(defun fs-f-goedel (&rest args) |
2607 |
(erbnoc-fortune "goedel")) |
(erbn-fortune "goedel")) |
2608 |
(defalias 'fs-goedel 'fs-f-goedel) |
(defalias 'fs-goedel 'fs-f-goedel) |
2609 |
|
|
2610 |
|
|
2611 |
|
|
2612 |
|
|
2613 |
(defun fs-f-humorists (&rest args) |
(defun fs-f-humorists (&rest args) |
2614 |
(erbnoc-fortune "humorists")) |
(erbn-fortune "humorists")) |
2615 |
|
|
2616 |
|
|
2617 |
(defun fs-f-kids (&rest args) |
(defun fs-f-kids (&rest args) |
2618 |
(erbnoc-fortune "kids")) |
(erbn-fortune "kids")) |
2619 |
|
|
2620 |
|
|
2621 |
(defun fs-f-law (&rest args) |
(defun fs-f-law (&rest args) |
2622 |
(erbnoc-fortune "law")) |
(erbn-fortune "law")) |
2623 |
|
|
2624 |
(defalias 'fs-law 'fs-f-law) |
(defalias 'fs-law 'fs-f-law) |
2625 |
|
|
2626 |
|
|
2627 |
|
|
2628 |
(defun fs-f-linuxcookie (&rest args) |
(defun fs-f-linuxcookie (&rest args) |
2629 |
(erbnoc-fortune "linuxcookie")) |
(erbn-fortune "linuxcookie")) |
2630 |
|
|
2631 |
|
|
2632 |
(defun fs-f-love (&rest args) |
(defun fs-f-love (&rest args) |
2633 |
(erbnoc-fortune "love")) |
(erbn-fortune "love")) |
2634 |
|
|
2635 |
(defun fs-f-magic (&rest args) |
(defun fs-f-magic (&rest args) |
2636 |
(erbnoc-fortune "magic")) |
(erbn-fortune "magic")) |
2637 |
|
|
2638 |
|
|
2639 |
|
|
2640 |
(defun fs-f-medicine(&rest args) |
(defun fs-f-medicine(&rest args) |
2641 |
(erbnoc-fortune "medicine")) |
(erbn-fortune "medicine")) |
2642 |
|
|
2643 |
|
|
2644 |
|
|
2645 |
(defun fs-f-men-women (&rest args) |
(defun fs-f-men-women (&rest args) |
2646 |
(erbnoc-fortune "men-women")) |
(erbn-fortune "men-women")) |
2647 |
|
|
2648 |
(defalias 'fs-sexwar 'fs-f-men-women) |
(defalias 'fs-sexwar 'fs-f-men-women) |
2649 |
|
|
2652 |
|
|
2653 |
|
|
2654 |
(defun fs-f-miscellaneous(&rest args) |
(defun fs-f-miscellaneous(&rest args) |
2655 |
(erbnoc-fortune "miscellaneous")) |
(erbn-fortune "miscellaneous")) |
2656 |
|
|
2657 |
(defalias 'fs-f-misc 'fs-f-miscellaneous) |
(defalias 'fs-f-misc 'fs-f-miscellaneous) |
2658 |
|
|
2659 |
|
|
2660 |
|
|
2661 |
(defun fs-f-news (&rest args) |
(defun fs-f-news (&rest args) |
2662 |
(erbnoc-fortune "news")) |
(erbn-fortune "news")) |
2663 |
|
|
2664 |
|
|
2665 |
|
|
2666 |
(defun fs-f-people (&rest args) |
(defun fs-f-people (&rest args) |
2667 |
(erbnoc-fortune "people")) |
(erbn-fortune "people")) |
2668 |
|
|
2669 |
|
|
2670 |
(defun fs-f-pets (&rest args) |
(defun fs-f-pets (&rest args) |
2671 |
(erbnoc-fortune "pets")) |
(erbn-fortune "pets")) |
2672 |
|
|
2673 |
|
|
2674 |
|
|
2675 |
(defun fs-f-platitudes (&rest args) |
(defun fs-f-platitudes (&rest args) |
2676 |
(erbnoc-fortune "platitudes")) |
(erbn-fortune "platitudes")) |
2677 |
|
|
2678 |
|
|
2679 |
|
|
2680 |
(defun fs-f-politics (&rest args) |
(defun fs-f-politics (&rest args) |
2681 |
(erbnoc-fortune "politics")) |
(erbn-fortune "politics")) |
2682 |
|
|
2683 |
|
|
2684 |
(defun fs-f-science (&rest args) |
(defun fs-f-science (&rest args) |
2685 |
(erbnoc-fortune "science")) |
(erbn-fortune "science")) |
2686 |
|
|
2687 |
(defun fs-f-songs-poems (&rest args) |
(defun fs-f-songs-poems (&rest args) |
2688 |
(erbnoc-fortune "songs-poems")) |
(erbn-fortune "songs-poems")) |
2689 |
|
|
2690 |
|
|
2691 |
(defun fs-f-sports(&rest args) |
(defun fs-f-sports(&rest args) |
2692 |
(erbnoc-fortune "sports")) |
(erbn-fortune "sports")) |
2693 |
|
|
2694 |
|
|
2695 |
|
|
2696 |
|
|
2697 |
|
|
2698 |
(defun fs-f-startrek (&rest args) |
(defun fs-f-startrek (&rest args) |
2699 |
(erbnoc-fortune "startrek")) |
(erbn-fortune "startrek")) |
2700 |
(defalias 'fs-startrek 'fs-f-startrek) |
(defalias 'fs-startrek 'fs-f-startrek) |
2701 |
|
|
2702 |
|
|
2704 |
|
|
2705 |
|
|
2706 |
(defun fs-f-translate-me (&rest args) |
(defun fs-f-translate-me (&rest args) |
2707 |
(erbnoc-fortune "translate-me")) |
(erbn-fortune "translate-me")) |
2708 |
|
|
2709 |
|
|
2710 |
|
|
2711 |
(defun fs-f-wisdom(&rest args) |
(defun fs-f-wisdom(&rest args) |
2712 |
(erbnoc-fortune "wisdom")) |
(erbn-fortune "wisdom")) |
2713 |
(defalias 'fs-wisdom 'fs-f-wisdom) |
(defalias 'fs-wisdom 'fs-f-wisdom) |
2714 |
|
|
2715 |
|
|
2716 |
|
|
2717 |
(defun fs-f-work (&rest args) |
(defun fs-f-work (&rest args) |
2718 |
(erbnoc-fortune "work")) |
(erbn-fortune "work")) |
2719 |
|
|
2720 |
|
|
2721 |
|
|
2722 |
(defun fs-f-linux (&rest args) |
(defun fs-f-linux (&rest args) |
2723 |
(erbnoc-fortune "linux")) |
(erbn-fortune "linux")) |
2724 |
|
|
2725 |
(defun fs-f-perl (&rest args) |
(defun fs-f-perl (&rest args) |
2726 |
(erbnoc-fortune "perl")) |
(erbn-fortune "perl")) |
2727 |
|
|
2728 |
(defun fs-f-knghtbrd (&rest args) |
(defun fs-f-knghtbrd (&rest args) |
2729 |
(erbnoc-fortune "knghtbrd")) |
(erbn-fortune "knghtbrd")) |
2730 |
|
|
2731 |
|
|
2732 |
|
|
2733 |
|
|
2734 |
(defun fs-f-quotes-emacs-channel (&rest args) |
(defun fs-f-quotes-emacs-channel (&rest args) |
2735 |
(erbnoc-fortune "~/fortune-emacschannelquotes")) |
(erbn-fortune "~/fortune-emacschannelquotes")) |
2736 |
(defalias 'fs-f-emacs 'fs-f-quotes-emacs-channel) |
(defalias 'fs-f-emacs 'fs-f-quotes-emacs-channel) |
2737 |
(defalias 'fs-f-quotes-emacs 'fs-f-quotes-emacs-channel) |
(defalias 'fs-f-quotes-emacs 'fs-f-quotes-emacs-channel) |
2738 |
(defalias 'fs-quotes-emacs 'fs-f-quotes-emacs-channel) |
(defalias 'fs-quotes-emacs 'fs-f-quotes-emacs-channel) |
2933 |
(setq more (buffer-substring new-point (point-max))) |
(setq more (buffer-substring new-point (point-max))) |
2934 |
(if |
(if |
2935 |
(string-match "[^ \t\n]" more ) |
(string-match "[^ \t\n]" more ) |
2936 |
(setq ans (concat ans " ..[Type " erbnoc-char "more]")) |
(setq ans (concat ans " ..[Type " erbn-char "more]")) |
2937 |
(when nomorep (setq more ""))) |
(when nomorep (setq more ""))) |
2938 |
) |
) |
2939 |
) |
) |
3028 |
|
|
3029 |
|
|
3030 |
(defun fsi-apropos (&optional regexp N M &rest ignored) |
(defun fsi-apropos (&optional regexp N M &rest ignored) |
3031 |
(fs-apropos-basic 'erbnoc-apropos regexp N M)) |
(fs-apropos-basic 'erbn-apropos regexp N M)) |
3032 |
(defun fsi-apropos-command (&optional regexp n m &rest ignored) |
(defun fsi-apropos-command (&optional regexp n m &rest ignored) |
3033 |
(fs-apropos-basic 'erbnoc-apropos-command regexp n m )) |
(fs-apropos-basic 'erbn-apropos-command regexp n m )) |
3034 |
(defun fsi-apropos-variable (&optional regexp n m &rest ignored) |
(defun fsi-apropos-variable (&optional regexp n m &rest ignored) |
3035 |
(fs-apropos-basic 'erbnoc-apropos-variable regexp n m )) |
(fs-apropos-basic 'erbn-apropos-variable regexp n m )) |
3036 |
(defun fsi-apropos-function (&optional regexp n m &rest ignored) |
(defun fsi-apropos-function (&optional regexp n m &rest ignored) |
3037 |
(fs-apropos-basic 'erbnoc-apropos-function regexp n m )) |
(fs-apropos-basic 'erbn-apropos-function regexp n m )) |
3038 |
(defun fsi-apropos-value (&optional regexp n m &rest ignored) |
(defun fsi-apropos-value (&optional regexp n m &rest ignored) |
3039 |
(fs-apropos-basic 'apropos-value regexp n m )) |
(fs-apropos-basic 'apropos-value regexp n m )) |
3040 |
(defun fsi-apropos-documentation (&optional regexp n m &rest ignored) |
(defun fsi-apropos-documentation (&optional regexp n m &rest ignored) |
3041 |
(fs-apropos-basic 'erbnoc-apropos-documentation regexp n m )) |
(fs-apropos-basic 'erbn-apropos-documentation regexp n m )) |
3042 |
|
|
3043 |
(defun erbnoc-apropos-documentation (reg) |
(defun erbn-apropos-documentation (reg) |
3044 |
(mapcar 'car (apropos-documentation reg))) |
(mapcar 'car (apropos-documentation reg))) |
3045 |
(defun erbnoc-apropos-command (reg) |
(defun erbn-apropos-command (reg) |
3046 |
(apropos-internal reg |
(apropos-internal reg |
3047 |
'commandp)) |
'commandp)) |
3048 |
|
|
3049 |
|
|
3050 |
|
|
3051 |
(defun erbnoc-apropos-function (reg) |
(defun erbn-apropos-function (reg) |
3052 |
(apropos-internal reg |
(apropos-internal reg |
3053 |
'functionp)) |
'functionp)) |
3054 |
|
|
3055 |
(defun erbnoc-apropos-variable (reg) |
(defun erbn-apropos-variable (reg) |
3056 |
(apropos-internal reg |
(apropos-internal reg |
3057 |
(lambda (s) |
(lambda (s) |
3058 |
(or (boundp s) |
(or (boundp s) |
3059 |
(user-variable-p s))))) |
(user-variable-p s))))) |
3060 |
|
|
3061 |
|
|
3062 |
(defun erbnoc-apropos (regexp) |
(defun erbn-apropos (regexp) |
3063 |
(apropos-internal regexp |
(apropos-internal regexp |
3064 |
(lambda (symbol) |
(lambda (symbol) |
3065 |
(or |
(or |
3455 |
"TODO: implemenet fixedcase, literal, subexp... If needed, let the |
"TODO: implemenet fixedcase, literal, subexp... If needed, let the |
3456 |
author know.." |
author know.." |
3457 |
(unless (and from to term) |
(unless (and from to term) |
3458 |
(error (format "Syntax: %s (replace-regexp FROM TO TERM &optional NUMBER)" erbnoc-char))) |
(error (format "Syntax: %s (replace-regexp FROM TO TERM &optional NUMBER)" erbn-char))) |
3459 |
(erbnocmd-iterate-internal term number 'replace-regexp-in-string from to |
(erbnocmd-iterate-internal term number 'replace-regexp-in-string from to |
3460 |
nil) |
nil) |
3461 |
(format "Replaced regexp %S with %S" from to)) |
(format "Replaced regexp %S with %S" from to)) |
3478 |
|
|
3479 |
(defun fsi-merge (&optional name dest &rest args) |
(defun fsi-merge (&optional name dest &rest args) |
3480 |
(unless (and name dest (not args)) |
(unless (and name dest (not args)) |
3481 |
(error (format "Syntax: %s merge TERM1 TERM2" erbnoc-char))) |
(error (format "Syntax: %s merge TERM1 TERM2" erbn-char))) |
3482 |
(setq name (format "%s" name)) |
(setq name (format "%s" name)) |
3483 |
(setq dest (format "%s" dest)) |
(setq dest (format "%s" dest)) |
3484 |
(when (string= (downcase name) (downcase dest)) |
(when (string= (downcase name) (downcase dest)) |
3507 |
Do not confuse this function with fs-rearrange which rearranges the |
Do not confuse this function with fs-rearrange which rearranges the |
3508 |
order of entries within a given term. " |
order of entries within a given term. " |
3509 |
(when (or args (not (and name dest))) |
(when (or args (not (and name dest))) |
3510 |
(error (format "Format: %s mv foo bar" erbnoc-char))) |
(error (format "Format: %s mv foo bar" erbn-char))) |
3511 |
(setq name (format "%s" name)) |
(setq name (format "%s" name)) |
3512 |
(setq dest (format "%s" dest)) |
(setq dest (format "%s" dest)) |
3513 |
(cond |
(cond |
3541 |
(catch 'erbnocmd-tag-foo |
(catch 'erbnocmd-tag-foo |
3542 |
(unless (equal (length msg) 3) |
(unless (equal (length msg) 3) |
3543 |
(throw 'erbnocmd-tag-foo |
(throw 'erbnocmd-tag-foo |
3544 |
`(fs-error (format "Syntax: %s N->M in TERM" erbnoc-char)))) |
`(fs-error (format "Syntax: %s N->M in TERM" erbn-char)))) |
3545 |
(unless (equal (downcase (format "%s" (second msg))) "in") |
(unless (equal (downcase (format "%s" (second msg))) "in") |
3546 |
(throw 'erbnocmd-tag-foo |
(throw 'erbnocmd-tag-foo |
3547 |
`(fs-error (format "Syntax: %s N->M in TERM" erbnoc-char)))) |
`(fs-error (format "Syntax: %s N->M in TERM" erbn-char)))) |
3548 |
(let (term |
(let (term |
3549 |
fromto |
fromto |
3550 |
lenfromto |
lenfromto |
3555 |
(setq lenfromto (length fromto)) |
(setq lenfromto (length fromto)) |
3556 |
(unless (= lenfromto 2) |
(unless (= lenfromto 2) |
3557 |
(throw 'erbnocmd-tag-foo |
(throw 'erbnocmd-tag-foo |
3558 |
`(fs-error (format "Syntax: %s N->M in TERM" erbnoc-char)))) |
`(fs-error (format "Syntax: %s N->M in TERM" erbn-char)))) |
3559 |
`(fs-rearrange ,(first fromto) ,(second fromto) ,term)))) |
`(fs-rearrange ,(first fromto) ,(second fromto) ,term)))) |
3560 |
|
|
3561 |
|
|
3699 |
(defun fsi-replace-string (&optional from to term number) |
(defun fsi-replace-string (&optional from to term number) |
3700 |
(unless (and from to term) |
(unless (and from to term) |
3701 |
(error |
(error |
3702 |
(format "Syntax: %s s/foo.../bar in TERM [NUMBER or ALL]" erbnoc-char))) |
(format "Syntax: %s s/foo.../bar in TERM [NUMBER or ALL]" erbn-char))) |
3703 |
(erbot-working |
(erbot-working |
3704 |
(erbnocmd-iterate-internal |
(erbnocmd-iterate-internal |
3705 |
(or (erbbdb-get-exact-name term ) term) |
(or (erbbdb-get-exact-name term ) term) |
3788 |
|
|
3789 |
(defun fsi-info-file (&optional infofile regexp) |
(defun fsi-info-file (&optional infofile regexp) |
3790 |
(unless regexp |
(unless regexp |
3791 |
(error (format "Syntax: %s info-node nodename REGEXP" erbnoc-char))) |
(error (format "Syntax: %s info-node nodename REGEXP" erbn-char))) |
3792 |
(unless (stringp regexp) (setq regexp (format "%s" regexp))) |
(unless (stringp regexp) (setq regexp (format "%s" regexp))) |
3793 |
|
|
3794 |
|
|
3795 |
(unless infofile (error (format "Syntax: %s info info-file REGEXP" |
(unless infofile (error (format "Syntax: %s info info-file REGEXP" |
3796 |
erbnoc-char))) |
erbn-char))) |
3797 |
(unless (stringp infofile) (setq infofile (format "%s" infofile))) |
(unless (stringp infofile) (setq infofile (format "%s" infofile))) |
3798 |
|
|
3799 |
(cond |
(cond |
3817 |
|
|
3818 |
(defun fsi-locate-library (&optional arg &rest rest) |
(defun fsi-locate-library (&optional arg &rest rest) |
3819 |
"REST WILL be ignored :-)" |
"REST WILL be ignored :-)" |
3820 |
(unless arg (format (error "Syntax: %s locate-library LIB" erbnoc-char))) |
(unless arg (format (error "Syntax: %s locate-library LIB" erbn-char))) |
3821 |
(unless (stringp arg) |
(unless (stringp arg) |
3822 |
(setq arg (format "%s" arg))) |
(setq arg (format "%s" arg))) |
3823 |
(locate-library arg)) |
(locate-library arg)) |
3831 |
|
|
3832 |
|
|
3833 |
(defun fsi-dict (&optional word &rest ignore) |
(defun fsi-dict (&optional word &rest ignore) |
3834 |
(unless word (error (format "Syntax: %s d[ict] word" erbnoc-char))) |
(unless word (error (format "Syntax: %s d[ict] word" erbn-char))) |
3835 |
(unless (stringp word) (setq word (format "%s" word))) |
(unless (stringp word) (setq word (format "%s" word))) |
3836 |
(fs-dictionary-search word)) |
(fs-dictionary-search word)) |
3837 |
|
|
3920 |
;;; "No karma defined for %s, use ,ENTITY++ or ,karma-create" fir |
;;; "No karma defined for %s, use ,ENTITY++ or ,karma-create" fir |
3921 |
;;; ))))) |
;;; ))))) |
3922 |
|
|
3923 |
;;; (defvar erbnoc-karma-pt 10) |
;;; (defvar erbn-karma-pt 10) |
3924 |
|
|
3925 |
;;; (defun fs-karma-increase (&optional arg points &rest ignore) |
;;; (defun fs-karma-increase (&optional arg points &rest ignore) |
3926 |
;;; (unless arg (error "Syntax: foo++ [&optional NUMBER]")) |
;;; (unless arg (error "Syntax: foo++ [&optional NUMBER]")) |
3927 |
;;; (when (stringp points) |
;;; (when (stringp points) |
3928 |
;;; (setq points (ignore-errors (read points)))) |
;;; (setq points (ignore-errors (read points)))) |
3929 |
;;; (unless (and (integerp points) |
;;; (unless (and (integerp points) |
3930 |
;;; (<= (abs points) erbnoc-karma-pt)) |
;;; (<= (abs points) erbn-karma-pt)) |
3931 |
;;; (setq points erbnoc-karma-pt)) |
;;; (setq points erbn-karma-pt)) |
3932 |
;;; (setq arg (downcase (format "%s" arg))) |
;;; (setq arg (downcase (format "%s" arg))) |
3933 |
;;; (erbkarma-increase arg points)) |
;;; (erbkarma-increase arg points)) |
3934 |
|
|
3950 |
;;; (when (stringp points) |
;;; (when (stringp points) |
3951 |
;;; (setq points (ignore-errors (read points)))) |
;;; (setq points (ignore-errors (read points)))) |
3952 |
;;; (unless (and (integerp points) |
;;; (unless (and (integerp points) |
3953 |
;;; (<= (abs points) erbnoc-karma-pt)) |
;;; (<= (abs points) erbn-karma-pt)) |
3954 |
;;; (setq points erbnoc-karma-pt)) |
;;; (setq points erbn-karma-pt)) |
3955 |
;;; (setq arg (downcase (format "%s" arg))) |
;;; (setq arg (downcase (format "%s" arg))) |
3956 |
;;; (erbkarma-decrease arg points)) |
;;; (erbkarma-decrease arg points)) |
3957 |
|
|
3974 |
|
|
3975 |
|
|
3976 |
(defun fsi-country (&optional ct) |
(defun fsi-country (&optional ct) |
3977 |
(unless ct (error (format "Syntax: %s country NM (example , country jp)" erbnoc-char))) |
(unless ct (error (format "Syntax: %s country NM (example , country jp)" erbn-char))) |
3978 |
(setq ct (format "%s" ct)) |
(setq ct (format "%s" ct)) |
3979 |
(let ((addp (and (> (length ct) 1) |
(let ((addp (and (> (length ct) 1) |
3980 |
;; does not start with . |
;; does not start with . |
4119 |
|
|
4120 |
(erbutils-defalias-i '(faith-correct-string)) |
(erbutils-defalias-i '(faith-correct-string)) |
4121 |
|
|
4122 |
(defun erbnoc-shell-test (string &optional substrings) |
(defun erbn-shell-test (string &optional substrings) |
4123 |
"Return t if any of the substrings matches string.. Used to weed |
"Return t if any of the substrings matches string.. Used to weed |
4124 |
out harmful shell code.. |
out harmful shell code.. |
4125 |
|
|
4138 |
substrings) |
substrings) |
4139 |
found)) |
found)) |
4140 |
|
|
4141 |
(defalias 'fsi-shell-test 'erbnoc-shell-test) |
(defalias 'fsi-shell-test 'erbn-shell-test) |
4142 |
|
|
4143 |
(defmacro erbnoc-with-web-page-buffer (site &rest body) |
(defmacro erbn-with-web-page-buffer (site &rest body) |
4144 |
(let ((buffer (make-symbol "web-buffer"))) |
(let ((buffer (make-symbol "web-buffer"))) |
4145 |
`(let ((,buffer (url-retrieve-synchronously ,site))) |
`(let ((,buffer (url-retrieve-synchronously ,site))) |
4146 |
(save-excursion |
(save-excursion |
4152 |
(kill-buffer ,buffer)))))) |
(kill-buffer ,buffer)))))) |
4153 |
|
|
4154 |
(defun fsi-web-page-title (&optional site &rest args) |
(defun fsi-web-page-title (&optional site &rest args) |
4155 |
(unless site (error (format "Syntax: %s web-page-title SITE" erbnoc-char))) |
(unless site (error (format "Syntax: %s web-page-title SITE" erbn-char))) |
4156 |
(setq site (format "%s" site)) |
(setq site (format "%s" site)) |
4157 |
(erbnoc-with-web-page-buffer site |
(erbn-with-web-page-buffer site |
4158 |
(let* ((case-fold-search t) |
(let* ((case-fold-search t) |
4159 |
(beg (search-forward "<title>" nil t)) |
(beg (search-forward "<title>" nil t)) |
4160 |
(end (search-forward "</title>" nil t))) |
(end (search-forward "</title>" nil t))) |
4165 |
"not available"))))) |
"not available"))))) |
4166 |
|
|
4167 |
(defun fsi-wserver (&optional site &rest args) |
(defun fsi-wserver (&optional site &rest args) |
4168 |
(unless site (error (format "Syntax: %s wserver SITE" erbnoc-char))) |
(unless site (error (format "Syntax: %s wserver SITE" erbn-char))) |
4169 |
(setq site (format "%s" site)) |
(setq site (format "%s" site)) |
4170 |
(erbnoc-with-web-page-buffer site |
(erbn-with-web-page-buffer site |
4171 |
(buffer-substring (point-min) |
(buffer-substring (point-min) |
4172 |
(or (search-forward "\n\n" nil t) |
(or (search-forward "\n\n" nil t) |
4173 |
(point-max))))) |
(point-max))))) |
4175 |
(defalias 'fs-webserver 'fs-wserver) |
(defalias 'fs-webserver 'fs-wserver) |
4176 |
|
|
4177 |
(defun fsi-web (&optional site &rest args) |
(defun fsi-web (&optional site &rest args) |
4178 |
(unless site (error (format "Syntax: %s web SITE" erbnoc-char))) |
(unless site (error (format "Syntax: %s web SITE" erbn-char))) |
4179 |
(setq site (format "%s" site)) |
(setq site (format "%s" site)) |
4180 |
(erbnoc-with-web-page-buffer site |
(erbn-with-web-page-buffer site |
4181 |
(shell-command-on-region (or (search-forward "\n\n" nil t) |
(shell-command-on-region (or (search-forward "\n\n" nil t) |
4182 |
(point-min)) |
(point-min)) |
4183 |
(point-max) |
(point-max) |
4677 |
|
|
4678 |
(erbutils-defalias-i '(macroexpand)) |
(erbutils-defalias-i '(macroexpand)) |
4679 |
(defun fsi-kick (&optional reason &rest ignore) |
(defun fsi-kick (&optional reason &rest ignore) |
4680 |
(erc-cmd-KICK erbnoc-nick (when reason (format "%s" reason)))) |
(erc-cmd-KICK erbn-nick (when reason (format "%s" reason)))) |
4681 |
|
|
4682 |
|
|
4683 |
;;"/usr/share/emacs/21.2/lisp/emacs-lisp/pp.el" |
;;"/usr/share/emacs/21.2/lisp/emacs-lisp/pp.el" |
4704 |
query to another user. " |
query to another user. " |
4705 |
`(cond |
`(cond |
4706 |
;; This can occur when you are requesting a parse.. |
;; This can occur when you are requesting a parse.. |
4707 |
((null erbnoc-nick) |
((null erbn-nick) |
4708 |
(progn ,@args)) |
(progn ,@args)) |
4709 |
(t |
(t |
4710 |
(progn |
(progn |
4711 |
(setq erbnoc-tgt erbnoc-nick) |
(setq erbn-tgt erbn-nick) |
4712 |
;; If there isn't already a buffer, create one.. |
;; If there isn't already a buffer, create one.. |
4713 |
(erbnoc-query erbnoc-nick) |
(erbn-query erbn-nick) |
4714 |
,@args)))) |
,@args)))) |
4715 |
|
|
4716 |
(defun erbnoc-query (qnick) |
(defun erbn-query (qnick) |
4717 |
(save-excursion (erc-query qnick erbnoc-buffer))) |
(save-excursion (erc-query qnick erbn-buffer))) |
4718 |
|
|
4719 |
|
|
4720 |
|
|