|
Warning: this is an htmlized version!
The original is here, and the conversion rules are here. |
;; (find-fline "~/Plans/")
;; (find-planner "~/Plans/EmacsWiki")
;; (find-planner "~/Plans/PlannerMode")
;; (find-es "emacs" "planner")
;; (find-eevnotesfile "")
;; (find-eevnotesfile "ew-escripts.el")
;; (find-eevnotesfile "muse-ecolors.el")
;; (find-eevnotesfile "muse-escripts.el")
;; (find-eevnotesfile "muse-escripts.shadow")
;; How do we publish with different defaults in different html dirs?
;; Like, one in ~/WebWiki, another in ~/TH/L/WebWiki, etc?
;; (find-angg ".emacs" "emacs-wiki-edrx")
;; (find-emacswikifile "")
;; (find-emacswikifile "EmacsWikiEl")
;;
(require 'emacs-wiki)
;; To do: change emacs-wiki-follow-name-at-point to let it follow es#
;; or angg# links correctly; also, implement info-node links
;; (find-efunction 'emacs-wiki-follow-name-at-point)
;; (find-efunction 'emacs-wiki-visit-link)
;;;;;
;;
;; new protocols
;;
;;;;;
;; (find-emacswikifile "emacs-wiki.el")
;; (find-evariable 'emacs-wiki-url-protocols)
;; (find-efunctionpp 'brw)
;; (setq browse-url-browser-function 'brw)
;; (emacs-wiki-browse-url "info://emacs#Command Index")
;; (emacs-wiki-browse-url "angg://.emacs#emacs-wiki-edrx")
;; (emacs-wiki-browse-url "anggfile://davidwest.txt")
;; (emacs-wiki-browse-url "anggpage://index.html#CoE")
;; (emacs-wiki-browse-url "es://emacs#planner-nondebian")
;; (emacs-wiki-resolve-url-google "google://foobar")
;; (emacs-wiki-resolve-url-angg "angg://.emacs#emacs-wiki-edrx")
;; (emacs-wiki-resolve-url-anggfile "anggfile://davidwest.txt")
;; (emacs-wiki-resolve-url-anggpage "anggpage://index.html#CoE")
;; (emacs-wiki-resolve-url-es "es://emacs#planner-nondebian")
;; (emacs-wiki-link-url "google://foobar")
;; (find-efunction 'emacs-wiki-link-url)
;; (find-efunction 'emacs-wiki-markup-link)
;; (brw "$HOME/TH/L/index.html")
(defmacro emacs-wiki-if-url-has-hash (prefix url code-if code-else)
`(if (string-match (concat "^" ,prefix "\\([^#]+\\)#\\(.*\\)") ,url)
(let ((part1 (match-string 1 ,url))
(part2 (match-string 2 ,url)))
,code-if)
(if (string-match (concat ,prefix "\\(.*\\)") ,url)
(let ((part1 (match-string 1 ,url)))
,code-else)
(error "url %S doesn't start with prefix %S" url prefix))))
(defun emacs-wiki-browse-url-angg (url)
"Jump to an \"angg://\" target using `find-angg'."
(emacs-wiki-if-url-has-hash "angg://" url
(find-angg part1 part2)
(find-angg part1)))
(defun emacs-wiki-browse-url-anggfile (url)
"Jump to an \"anggfile://\" target using `find-anggfile'."
(emacs-wiki-if-url-has-hash "anggfile://" url
(find-anggfile part1 part2)
(find-anggfile part1)))
(defun emacs-wiki-browse-url-anggpage (url)
"Jump to an \"anggpage://\" target using `find-anggfile'."
(emacs-wiki-if-url-has-hash "anggpage://" url
(browse-url (format "%s/TH/L/%s#%s" (getenv "HOME") part1 part2))
(browse-url (format "%s/TH/L/%s" (getenv "HOME") part1))))
(defun emacs-wiki-browse-url-es (url)
"Jump to an \"es://\" target using `find-es'."
(emacs-wiki-if-url-has-hash "es://" url
(find-es part1 part2)
(find-es part1)))
(defun emacs-wiki-resolve-url-angg (url)
"Resolve \"angg://\" urls"
(emacs-wiki-if-url-has-hash "angg://" url
(format "../%s.html#%s" part1 part2)
(format "../%s.html" part1)))
(defun emacs-wiki-resolve-url-anggfile (url)
"Resolve \"angg://\" urls"
(emacs-wiki-if-url-has-hash "anggfile://" url
(format "../%s#%s" part1 part2)
(format "../%s" part1)))
(defun emacs-wiki-resolve-url-anggpage (url)
"Resolve \"anggpage://\" urls"
(emacs-wiki-if-url-has-hash "anggpage://" url
(format "../%s#%s" part1 part2)
(format "../%s" part1)))
(defun emacs-wiki-resolve-url-es (url)
"Resolve \"es://\" urls"
(emacs-wiki-if-url-has-hash "es://" url
(format "../e/%s.e.html#%s" part1 part2)
(format "../e/%s.e.html" part1)))
(defun emacs-wiki-resolve-url-info (url)
"Resolve \"info://\" urls"
(emacs-wiki-if-url-has-hash "info://" url
(format "http://127.0.0.1/cgi-bin/info2www?(%s)%s" part1 part2)
(format "http://127.0.0.1/cgi-bin/info2www?(%s)%s" part1 "Top")))
(defun emacs-wiki-resolve-url-man (url)
"Resolve \"man://\" urls"
(emacs-wiki-if-url-has-hash "man://" url
(format "http://127.0.0.1/cgi-bin/man2html?%s"
(replace-regexp-in-string " " "+" part1))
(format "http://127.0.0.1/cgi-bin/man2html?%s"
(replace-regexp-in-string " " "+" part1))))
;; (emacs-wiki-resolve-url-info "info://emacs-21/emacs#User Input")
;; (emacs-wiki-resolve-url-info "info://Tcl")
;; (emacs-wiki-resolve-url-man "man://Tcl")
;; (emacs-wiki-resolve-url-man "man://3tcl Tcl")
(add-to-alist 'emacs-wiki-url-protocols
'("info" emacs-wiki-browse-url-info emacs-wiki-resolve-url-info))
(add-to-alist 'emacs-wiki-url-protocols
'("man" emacs-wiki-browse-url-man emacs-wiki-resolve-url-man))
(add-to-alist 'emacs-wiki-url-protocols
'("angg" emacs-wiki-browse-url-angg emacs-wiki-resolve-url-angg))
(add-to-alist 'emacs-wiki-url-protocols
'("anggfile" emacs-wiki-browse-url-anggfile emacs-wiki-resolve-url-anggfile))
(add-to-alist 'emacs-wiki-url-protocols
'("anggpage" emacs-wiki-browse-url-anggpage emacs-wiki-resolve-url-anggpage))
(add-to-alist 'emacs-wiki-url-protocols
'("es" emacs-wiki-browse-url-es emacs-wiki-resolve-url-es))
(emacs-wiki-set-sym-and-url-regexp
'emacs-wiki-url-protocols emacs-wiki-url-protocols)
;;;;;
;;
;; interwiki links with non-wiki targets
;;
;;;;;
;; (find-elnode "Regexp Search")
;; (list (ee-before-hash "foo#bar") (ee-after-hash))
;; (list (ee-before-hash "foo/bar") (ee-after-hash))
;; (find-efunction 'emacs-wiki-wiki-tag)
;;
(defvar ee-after-hash nil)
(defun ee-after-hash () ee-after-hash)
(defun ee-before-hash (str)
(if (string-match "#" str)
(progn (setq ee-after-hash (substring str (match-end 0)))
(substring str 0 (match-beginning 0)))
(setq ee-after-hash nil)
str))
(defvar emacs-wiki-interwiki-non-wiki-methods
'(("angg" . (lambda (tag) (find-angg (ee-before-hash tag) (ee-after-hash))))
("anggfile" . (lambda (tag) (find-angg tag)))
("info" . (lambda (tag) (find-node tag)))
("es" . (lambda (tag) (find-es (ee-before-hash tag) (ee-after-hash)))))
"A table of WikiNames with non-wiki targets.
This Controls how `emacs-wiki-visit-link' follows some interwiki links.
This is an Edrxish hack.")
(defadvice emacs-wiki-visit-link
(around emacs-wiki-edrx
(link-name &optional refresh-buffer other-window)
activate)
"See `emacs-wiki-interwiki-non-wiki-methods'."
(let ((base (assoc (ee-before-hash link-name)
emacs-wiki-interwiki-non-wiki-methods)))
(if base (funcall (cdr base) (ee-after-hash))
ad-do-it)))
;; (emacs-wiki-visit-link "anggfile#.emacs")
;; (emacs-wiki-visit-link "angg#.emacs#emacs-wiki-edrx")
;; (emacs-wiki-visit-link "info#(elisp)Top")
;; (emacs-wiki-visit-link "info#(elisp)Major Modes")
;;;;;
;;
;; Adding new interwiki names
;;
;;;;;
;; (find-evardescr 'emacs-wiki-interwiki-names)
;; (find-evariable 'emacs-wiki-interwiki-names)
;; (emacs-wiki-wiki-link-target "angg#index")
;; (emacs-wiki-wiki-link-target "es#emacs")
;;
(add-to-alist 'emacs-wiki-interwiki-names
'("anggfile" . (lambda (tag) (concat "../TH/L/" (or tag "")))))
(add-to-alist 'emacs-wiki-interwiki-names
'("angg" . (lambda (tag) (concat "../TH/L/" (or tag "") ".html"))))
(add-to-alist 'emacs-wiki-interwiki-names
'("es" . (lambda (tag) (concat "../TH/L/e/" (or tag "") ".e.html"))))
(add-to-alist 'emacs-wiki-interwiki-names
'("EevNotes" .
(lambda (tag) (concat "../eev-current/Notes/" (or tag "") ".html"))))
;; [[es#emacs]]
;; [[angg#index]]
;; EevNotes
(defvar emacs-wiki-info2www-url "http://127.0.0.1/cgi-bin/info2www")
(add-to-alist 'emacs-wiki-interwiki-names
'("info" .
(lambda (tag)
(concat emacs-wiki-info2www-url
(if tag
(concat "?" (replace-regexp-in-string " " "+" tag))
"")))))
;; (find-efunction 'emacs-wiki-markup-link)
;; (find-efunction 'emacs-wiki-link-url)
;; (find-efunction 'emacs-wiki-wiki-link-target)
;; (emacs-wiki-wiki-link-target "info#(emacs)Major Modes")
;; (emacs-wiki-link-url "info#(emacs)Major Modes")
(provide 'emacs-wiki-edrx)