|
Warning: this is an htmlized version!
The original is here, and the conversion rules are here. |
#######
#
# E-scripts on emacs-wiki, planner,and muse
#
# Note 1: use the eev command (defined in eev.el) and the
# ee alias (in my .zshrc) to execute parts of this file.
# Executing this file as a whole makes no sense.
# An introduction to eev can be found here:
#
# (find-eev-quick-intro)
# http://angg.twu.net/eev-intros/find-eev-quick-intro.html
#
# Note 2: be VERY careful and make sure you understand what
# you're doing.
#
# Note 3: If you use a shell other than zsh things like |&
# and the for loops may not work.
#
# Note 4: I always run as root.
#
# Note 5: some parts are too old and don't work anymore. Some
# never worked.
#
# Note 6: the definitions for the find-xxxfile commands are on my
# .emacs.
#
# Note 7: if you see a strange command check my .zshrc -- it may
# be defined there as a function or an alias.
#
# Note 8: the sections without dates are always older than the
# sections with dates.
#
# This file is at <http://angg.twu.net/e/ewiki.e>
# or at <http://angg.twu.net/e/ewiki.e.html>.
# See also <http://angg.twu.net/emacs.html>,
# <http://angg.twu.net/.emacs[.html]>,
# <http://angg.twu.net/.zshrc[.html]>,
# <http://angg.twu.net/escripts.html>,
# and <http://angg.twu.net/>.
#
#######
# «.emacs-wiki-edrx» (to "emacs-wiki-edrx")
# «.find-file-hook» (to "find-file-hook")
#####
#
# emacs-wiki-edrx
# 2004may08
#
#####
# «emacs-wiki-edrx» (to ".emacs-wiki-edrx")
# (find-angg ".emacs" "emacs-wiki-edrx")
# (find-angg "elisp/emacs-wiki-edrx.el")
# (find-emacswikifile "emacs-wiki.el")
# (find-evariable 'emacs-wiki-url-protocols)
(load-library "emacs-wiki-edrx")
;; (find-efunction 'split-string)
(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)))
;; (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")
(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#%s" 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)))
(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)
#####
#
# how files in ~/Wiki/ get emacs-wiki-mode by default
# 2004may02
#
#####
# «find-file-hook» (to ".find-file-hook")
# It's not by auto-mode-alist tricks:
#
(info "(elisp)Auto Major Mode")
(find-elnode "Auto Major Mode")
(find-enode "Choosing Modes")
(find-evardescr 'auto-mode-alist)
# It's by adding a hook:
#
(find-emacswikifile "emacs-wiki.el" "(add-hook 'find-file-hooks")
(find-efunction 'emacs-wiki-maybe)
(find-evariable 'emacs-wiki-directories)
(find-evardescr 'emacs-wiki-directories)
(find-efunction 'emacs-wiki-directories-member)
(find-evariable 'emacs-wiki-projects)
(find-evardescr 'emacs-wiki-projects)
# Local Variables:
# coding: utf-8-unix
# End: