;; Emacs-Time-stamp: "2007-11-22 10:45:08"
(setq file-stamp "Emacs-File-stamp: \"/home/ysverdlov/leninist.biz/_.el\"")
;; TO-DO:
;;
;; TO-DO:
;;
;; TO-DO:
;;
;; (_-find-file-hooks-__-globals "~/leninist.biz/es/1977/V343/20060310/099.tx")
(defun _-find-file-hooks-__-globals (&optional arg1bfn arg1wpn)
"DOC
Optional ARG1 is a buffer-file-name.
Optional ARG2, if non-nil, will cause an error if __WHERE_PAGE_NUMBERS__
missing"
(interactive)
(let (my-str my-pt my-re
my-rc)
(defun foo ()
""
;; fix!
;; Use function that returns paragraph contents minus __TAG__.
;; For list of fields, see file "__" in root directory.
;; ---------------------------------
(goto-char (point-min))
(when (setq my-pt
(search-forward-regexp
(setq my-re "__WHERE_PAGE_NUMBERS__") nil t))
;; en/1973/WICIR313/index.txt.log
;; __WHERE_PAGE_NUMBERS__
;; __WHERE_PAGE_NUMBERS__
;; (setq my-str (_-string-trim (car (_-para t t t)) " \t\n\r\""))
;; archive/lenin/works/cw/v36pp71/099even.tx.log
;; __WHERE_PAGE_NUMBERS__ 112
;; __WHERE_PAGE_NUMBERS__ top
(setq my-str (car (last (split-string (car (_-para t t t))))))
;; fix!
;; Where is other place where "top" / "bottom" is tested?
(when (not (string-match my-re my-str))
;; SEE ALSO: lb-tx.el: (setq _-where-page-numbers-global
;; SEE ALSO: lb-tx.el: (setq _-where-page-numbers-global
;; SEE ALSO: lb-tx.el: (setq _-where-page-numbers-global
(set (make-local-variable '_-where-page-numbers) my-str)
(_-app 'my-rc (list (cons "__WHERE_PAGE_NUMBERS__" my-str)))))
;; ---------------------------------
(goto-char (point-min))
(when (setq my-pt
(search-forward
(setq my-re "__FOOTNOTE_MARKER_STYLE__") nil t))
(setq my-str (_-string-trim (car (_-para t t t)) " \t\n\r\""))
(when (not (string-match my-re my-str))
(set (make-local-variable '_-footnote-marker-style) my-str)
(_-app 'my-rc (list (cons "__FOOTNOTE_MARKER_STYLE__" my-str)))))
;; ---------------------------------
(goto-char (point-min))
(when (setq my-pt
(search-forward
(setq my-re "__FOOTNOTE_MARKER_SEQUENCE__") nil t))
(setq my-str (_-string-trim (car (_-para t t t)) " \t\n\r\""))
(when (not (string-match my-re my-str))
(set (make-local-variable '_-footnote-marker-sequence) my-str)
(_-app 'my-rc (list (cons "__FOOTNOTE_MARKER_SEQUENCE__" my-str)))))
) ;; defun foo
(save-match-data
(save-excursion
(if (not arg1bfn)
(foo)
(with-temp-buffer
(insert-file-contents-literally arg1bfn)
(foo)))))
;; ---------------------------------
(if (and arg1wpn
my-rc
(not (assoc "__WHERE_PAGE_NUMBERS__" my-rc)))
(error "%s: %s" "Missing" "__WHERE_PAGE_NUMBERS__"))
my-rc))
(add-hook 'find-file-hooks '_-find-file-hooks-__-globals)
(defun _-dired-get-fullpath ()
"Return when using dired inside a book's tree"
;;
(interactive)
(let (lb-pt
lb-rc)
(when (eq 'dired-mode major-mode)
(setq lb-rc
(concat
(save-excursion
(goto-char (point-min))
(_-move-forward-whitespace)
(setq lb-pt (point))
(end-of-line)
(forward-char -1)
(buffer-substring-no-properties lb-pt (point)))
"/"))
(message lb-rc))
;;
lb-rc))
;; (_-something-to-list-of-integers -60)
;; (_-something-to-list-of-integers 1)
;; (_-something-to-list-of-integers 0 1)
;; (_-something-to-list-of-integers 1 1)
;; (_-something-to-list-of-integers '(1 . 2))
;; (_-something-to-list-of-integers '(1 2))
;; (_-something-to-list-of-integers '(1 . 3))
;; (_-something-to-list-of-integers '(1 3))
;; (_-something-to-list-of-integers '(1 3 6 88))
;; (_-something-to-list-of-integers '(333 111))
;; (_-something-to-list-of-integers '("333" 111))
;; (_-something-to-list-of-integers '(100 . 110))
;; (_-something-to-list-of-integers '(100 -3))
;; (_-something-to-list-of-integers '(100 . "-3"))
(defun _-something-to-list-of-integers (arg1 &optional arg2bound arg3whocalled)
"
If ARG2 is a string '+n' or '-n' it is added to ARG1 to get ARG2
"
;;
(let (_i _n0 _n1 _re
_rc)
;; Pre-transformation check: ARG1.
(if (and (not (listp arg1))
(not (integerp arg1)))
(error "%s: %s" "Expecting type of ARG1" "integer or list"))
;; Pre-transformation check: ARG2 if ARG1 is list.
(if (listp arg1)
(if (not (null arg2bound))
(error "%s: %s" "ARG1 is a list" "expecting ARG2 nil")))
;; Convert list of length 2 to ARG1 and ARG2.
;; Convert cons to ARG1 and ARG2.
;; BEFORE: (progn (setq arg1 '(1 . 2)))
;; BEFORE: (progn (setq arg1 '(100 . 110)))
;; BEFORE: (progn (setq arg1 '(120 . 110)))
;; BEFORE: (progn (setq arg1 '(1001 1101)))
;; BEFORE: (progn (setq arg1 '(1001 1101 2222)))
(when (and (listp arg1)
(or
;; cons
(and (= 1 (safe-length arg1))
(car-safe arg1)
(cdr-safe arg1))
;; list
(and (= 2 (length arg1)))))
(setq arg2bound
(if (= 1 (safe-length arg1))
(cdr arg1)
(nth 1 arg1)))
(setq arg1 (car arg1)))
;; MAIN
;; -------------------------------------------------------
(cond
;; Pass list (not length 2) through.
((listp arg1)
(setq _rc arg1))
;; Others.
(t
;; Check that ARG1 is greater-than zero if an integer.
;; (progn (setq arg1 -3))
(if (and (integerp arg1)
(<= arg1 0))
(error "%s: %s"
(concat "ARG1 (" (int-to-string arg1) ") is an integer")
"Expecting > 0"))
;; Change ARG2 if less-than 0 to string.
(if (and (integerp arg2bound)
(< arg2bound 0))
(setq arg2bound (int-to-string arg2bound)))
;; Change ARG2 if a string with relative amount.
;; (progn (setq arg1 13) (setq arg2bound "-3"))
;; (progn (setq arg1 13) (setq arg2bound "+3"))
;; (progn (setq arg1 13) (setq arg2bound "a3"))
;; (progn (setq arg1 13) (setq arg2bound "+3+"))
(if (stringp arg2bound)
(if (not (integerp arg1))
(error "%s: %s" "ARG2 is an string" "Expecting ARG1 as integer")
;; (string-to-int "a") => 0
(if (= (string-to-int arg2bound) 0)
(error "%s: %s" "ARG2 from string-to-int" " = 0")
(if (not (string-match (setq _re "^[-+][0-9]+$") arg2bound))
(error "%s: %s"
"ARG2 is a string"
(concat "expecting to match " _re))
(setq arg2bound (+ arg1 (string-to-int arg2bound)))))))
;; Default ARG2 if ARG1 is positive or negative integer.
(cond
((and arg3whocalled
(string= "lb-ht-generate-book" arg3whocalled))
(when (and (integerp arg1)
(null arg2bound)
(boundp 'lbg-sections)
(listp lbg-sections))
(setq arg2bound (1- (length lbg-sections)))
;; If ARG1 is positive, it is a start point. Otherwise...
(if (< arg1 0)
(setq arg1 (+ arg2bound arg1)))))
)
;; (progn (setq arg1 13) (setq arg2bound 15))
;; (progn (setq arg1 15) (setq arg2bound 13))
(if (integerp arg1)
(if (null arg2bound)
(error "%s: %s" "Need bound ARG2" "When ARG1 is an integer")
(if (not (integerp arg2bound))
(error "%s: %s" "ARG1 is integer" "ARG2 must be integer")
;; ARG1 and ARG2 integers.
;; Flip-flop?
(when (< arg2bound arg1)
(setq _i arg1)
(setq arg1 arg2bound)
(setq arg2bound _i)))))
(cond
((stringp arg1)
(setq _rc (list (string-to-int arg1) arg2bound)))
(t
(loop for i from arg1 to arg2bound
do
(cond
((and arg3whocalled
(string= "lb-ht-generate-book" arg3whocalled))
;; Last HREF is __ALPHA_LVL0__
(if
;; 2006.12.18
;; (<
(<=
i arg2bound)
(setq _rc (append _rc (list i)))))
(t
(setq _rc (append _rc (list i))))))))))
_rc))
(defun _-move-away-from-adjacent-blank-line ()
"After deleting __TAG__ pt. must be in paragraph for _-where-double-newlines"
;;
(let (_flag-blank-1up _flag-blank-1down
_rc)
(save-match-data
(progn
(if (not (_-blank-line-p))
(error "%s: %s" "Expecting point" "on blank line"))
(setq _flag-blank-1up
(save-excursion (forward-line -1) (if (_-blank-line-p) t)))
(setq _flag-blank-1down
(save-excursion (forward-line 1) (if (_-blank-line-p) t))))
(if (and _flag-blank-1down _flag-blank-1up)
(error "%s: %s" "Line above and line below"
(concat "BOTH are blank"
"\n" (_-buffer-substring-from-)))
(if
(and (not _flag-blank-1down) (not _flag-blank-1up))
(error "%s: %s" "Line above and line below"
(concat"NEITHER is blank"
"\n" (_-buffer-substring-from-)))))
(forward-line (+ 0 (if _flag-blank-1up 1 -1)))
)_rc))
(defun _-strip-^^-anchors nil
"Delete ^^55555^^ anchors from buffer"
;;
(let (
_rc)
(save-excursion
(save-match-data
(goto-char (point-min))
(while (search-forward-string lb-str-^^ nil t)
(replace-match "")
(setq _pt (point))
(search-forward-string lb-str-^^ nil nil)
(if (> (- (point) _pt)
5
)
(error "%s: %s" "Not expecting" (_-buffer-substring-from-))
(delete-region _pt (point))))
)) _rc))
;; fix! _-strip-br--M-9--^^-anchors ...is like... _-strip-markup-make-title=-safe
(defun _-strip-br--M-9--^^-anchors (arg1str)
""
;;
(let (_pt _class
_rc)
(save-match-data
(when arg1str
(with-temp-buffer
(insert arg1str)
;; 2007.08.27
(progn (goto-char (point-min))
(while (search-forward-regexp
(_-ws "
")
nil t)
(replace-match " • ")))
;; 2007.05.28
(progn (goto-char (point-min))
(while (search-forward-regexp "[\r]\\([-][0-9]+\\)" nil t)
(replace-match "" nil nil nil 1)))
;; 2007.05.28
(progn (goto-char (point-min))
(while (search-forward-regexp "
")
nil t)
(replace-match " • ")))
;; 2007.08.15
(progn (goto-char (point-min))
(while (search-forward-regexp "\\^\\^[0-9*]+\\^\\^" nil t)
(replace-match "")
(when (and (looking-at "")))))
(progn (goto-char (point-min))
(while (search-forward-regexp "<[/]?[A-Za-z]" nil t)
(when (not (_-sgml-comment-p))
(replace-match "")
(delete-region (point)
(search-forward-string ">")))))
(progn (goto-char (point-min))
(while (search-forward-regexp "[ \t\n\r]+" nil t)
(replace-match " ")))
(setq _rc (buffer-string))))
_rc))
;; (_-string-exist-end-of-line-p "already existss:")
(defun _-string-exist-end-of-line-p (arg1str)
"Return t if string ARG1 is in this buffer *and* at end-of-line.
Example,
put Filename
will return nil if this is only line in buffer with that string:
put Filename.txt"
;;
(let (
_rc)
(save-excursion
(save-match-data
(goto-char (point-min))
;; Before (while WAS: (if
(while (search-forward-string arg1str nil t)
(if (= (progn
(if (looking-at (concat "[ \t\r]" "+"))
(goto-char (match-end 0)))
(point))
(progn
(end-of-line)
(point)))
(setq _rc t)))))
_rc))
(defun _-filetype (arg1pathfile)
""
;;
(let (_filetype
_rc)
(string-match
(concat ".*: " "\\(" ".*" "\\)" "[\n]?$")
(setq _filetype
(shell-command-to-string
(concat "file " arg1pathfile))))
(setq _rc (match-string 1 _filetype))))
(defun _-delete-line ()
""
;;
(interactive)
(let (
_rc)
(beginning-of-line)
(delete-region (point)
(save-excursion (search-forward-regexp "[\n]")
(point)))
_rc))
;; (_-buffer-substring-from- (point) 50)
;; (_-buffer-substring-from- nil nil )
;; (_-buffer-substring-from- nil 20 t )
(defun _-buffer-substring-from- (&optional arg1from arg2chars arg3marker)
"Write buffer to ~/foo and return ARG2 chars with point ARG1 in the middle.
See also? _-buffer-substring ? how different?
If ARG1 is nil, it defaults to (point).
If ARG2 is nil, it defaults to 100 characters.
Uses buffer-substring such that a string of lenth ARG2 is returned with
point ARG1 in middle of that string.
Optional ARG3, if non-nil, suppresses marker showing location of ARG1"
;;
(let (lb-beg lb-end
_rc)
(save-match-data
(save-excursion
(if (file-exists-p "~/foo") (delete-file "~/foo"))
(write-region (point-min) (point-max) "~/foo")
(if (not arg1from) (setq arg1from (point)))
(if (not arg2chars) (setq arg2chars 100))
(if (< (setq lb-beg (- arg1from (/ arg2chars 2))) 1)
(setq lb-beg (point-min)))
(if (> (setq lb-end (+ lb-beg arg2chars)) (point-max))
(setq lb-end (point-max)))
(setq _rc
(concat (buffer-substring-no-properties lb-beg arg1from)
(if (not arg3marker)
(concat
;;"\n"
"<<<----- point here; see ~/foo "
;; 2006.09.18
(if (and (boundp 'lbg-i-from1)
(not (null lbg-i-from1)))
(concat "/s/" (int-to-string
lbg-i-from1) " "))
"----->>>"))
(buffer-substring-no-properties arg1from lb-end)))))
_rc))
;; fix! this is pointless! words already joined!
;; (_-join-hyphenated-words)
(defun _-join-hyphenated-words (&optional arg1)
"Wait a second! Words already joined in source .tx file for
spell-check reasons!
Does while loop over whole buffer.
This does what tx2txt.awk used to do in lb-tx-make-or-refresh-indextx.
Optional ARG1, if non-nil, does not move point to top of current
buffer before joining.
Before using this function, convert '--' to endash"
""
(interactive)
(let (_-pt _-flag-pg-num-para
_-flag-^M-dash-9
_-flag-^M-dash-sic
_-str-looking-back
_-flag-ws-^M-before
_-flag-ws-^M-after
_-flag-hyphen
(_-n-looking-back 10)
_-pt _-pt-beg _-pt-end
_-rc)
;; fix!
;; How to delete whitespace if mdash is on SECOND line?
;; EXAMPLE:
;; ~/leninist.biz/en/1970/LGT391/20060322/391.tx
;; and steadily increase capital investments in agriculture, etc., ^M
;; ---all these steps are the visible and practical realisation of Lenin's
;; fix!
;; Must move footnotes out of way before joining words split by page
;; break.
;; fix?
;; # fix! Does not seem to work... viewing index.txt in Opera shows
;; # space at beginning of line (the space after "^M").
;; fix!
;; How to join words split between pages?
;; fix!
;; Page number "8" is in middle of word: on the con8 trary,
;; ~/leninist.biz/en/0000/LTRSP88/20060216/088.tx
;; trary, at once begin to combat these instincts.
;; fix!
;; Change "--" to "-" for hyphenated words, like, "working-class"?
(if (not arg1) (goto-char (point-min)))
(while (and
(search-forward-regexp "[\r]" nil t)
(setq _-pt-end (match-end 0))
(setq _-pt-beg (match-beginning 0)))
(when
(and
;;; "~/leninist.biz/en/1984/AP470/20050704/399.tx"
;;; above fundamental theories both in the macro- ^M-0
;;; and microworlds. Nonetheless, it is rather a ^M
(not (looking-at
"[-][0]"))
;;;
;;; headed by Joseph McCarthy was particularly zealous in this witch-- ^M
;;;
;;; __NOTE__ Footnote continued on page 184.
;;;
;;; __NOTE__ Footnote continued from page 183.
;;;
;;; hunt. The purge instituted by this commission is one of the most ^M
(not (looking-at
;; fix!
;; Delete __NOTE__ first *and* allow blank line.
;; Next line cannot be blank.
(concat "[ \t\r]*" "[\n]"
"[ \t\r]*" "[\n]")))
;; Move back over ^M.
(goto-char _-pt-beg)
)
;; Move back over whitespace.
(if (not (_-move-backward-whitespace t nil))
(error "%s: %s" "Expecting whitespaces"
(_-buffer-substring-from- nil 200)))
;; Grab 10 characters.
(setq _-str-looking-back (buffer-substring-no-properties
(- (setq _-pt (point))
_-n-looking-back) _-pt))
;; Look for hyphen-like thing.
(if (not
(setq _-flag-hyphen
(cond
((string=
"-="
(substring _-str-looking-back
(- _-n-looking-back (length "-="))))
"-=")
;; Must come before "--".
((string= "---"
(substring _-str-looking-back
(- _-n-looking-back (length "---"))))
"---")
((string= "--"
(substring _-str-looking-back
(- _-n-looking-back (length "--"))))
"--")
((string= "–"
(substring _-str-looking-back
(- _-n-looking-back (length "–"))))
"–")
;; Must come after "--", such as, last.
((string= "-"
(substring _-str-looking-back
(- _-n-looking-back (length "-"))))
"-")))
)
;; Did not find something to change: move past ^M for next iteration.
(goto-char _-pt-end)
;; Invalid txup (markup) (2006.03.28).
(if (and (string= _-flag-hyphen "-=")
(string= "--="
(substring _-str-looking-back
(- _-n-looking-back (length "--=")))))
(error "%s: %s" "Cannot use equal-sign in --= ^M" (_-current-line)))
;; Change hyphen.
(cond
((or
(string= _-flag-hyphen "–")
(string= _-flag-hyphen "---")
(string= _-flag-hyphen "--"))
;; Do nothing, as permanent hyphen changed: "-- ^M" (to) "-= ^M".
nil)
((or
(string= _-flag-hyphen "-=")
(string= _-flag-hyphen "-"))
;; Delete "=" to retain permanent hyphen.
;; Delete "-" to delete real hyphen.
(delete-char -1))
) ;; cond
;; Delete whitespaces in middle of word, including ^M.
(if (not (looking-at _-whitespaces-wM))
(setq _-flag-ws-^M-before nil)
(setq _-flag-ws-^M-before (match-string-no-properties 0))
(replace-match ""))
;; fix?
;; If this only joins hyphenated words, DO NOT delete -9 and -sic.
;; Store "-9" after "^M-9".
(if (not (looking-at "[-][0-9]+"))
(setq _-flag-^M-dash-9 nil)
(setq _-flag-^M-dash-9 (match-string-no-properties 0))
(replace-match ""))
;; Store "-sic" after "^M-9-sic".
(if (not (looking-at "[-]sic"))
(setq _-flag-^M-dash-sic nil)
(setq _-flag-^M-dash-sic (match-string-no-properties 0))
(replace-match ""))
;; Delete whitespaces after ^M-9-sic, and before "\n\n999\n\n".
(if (not (looking-at "[ \t]+"))
(setq _-flag-ws-^M-after nil)
(setq _-flag-ws-^M-after (match-string-no-properties 0))
(replace-match ""))
;; Store page number (was word split between pages?).
(if (not (looking-at lb-re-bracketed-para-integer))
(setq _-flag-pg-num-para nil)
(setq _-flag-pg-num-para (match-string-no-properties 0))
(replace-match ""))
;; Skip over 2nd half of hyphenated word.
(search-forward-regexp _-^whitespaces-noM)
;; Put ^M and newline back.
;; fix? Why put dash-9 integer back?
;; Results in triple space in output when:
;; (1.) hyphenation removed.
;; (2.) carriage return converted to single space.
(insert (concat _-flag-ws-^M-before
_-flag-^M-dash-9
_-flag-^M-dash-sic
_-flag-ws-^M-after
_-flag-pg-num-para))
;; fix?
;; Why "toss out leading whitespace at beginning of line" ?
(when nil
;; Toss out leading whitespace at beginning of line
(if (looking-at "[ \t]+") (replace-match "")))
)))
_-rc))
;; (boundp 'anythinggoes)
;; (_-just-say-nil 'anythinggoes)
;; (boundp 'anythinggoes)
;; anythinggoes
;; (makunbound 'anythinggoes)
;; (setq anythinggoes "foobarfb")
;; (_-just-say-nil 'anythinggoes)
(defun _-just-say-nil (arg1symbol &optional arg2init)
"If not bound, set symbol ARG1 to nil and return nil. Otherwise return
its value. Useful when debugging a function and symbol ARG1 is
set to nil by let.
Most variables set to nil by let. Optional ARG2 is an
initial value other than nil.
Use this function if a variable is set by let to avoid 'void-variable' error
while testing pieces inside let. Wrap first usage of variable with this
function"
(let (
_-rc)
(setq _-rc (if (boundp arg1symbol) (eval arg1symbol)
(set arg1symbol
(if arg2init arg2init nil))))
_-rc))
;; (_-blank-line-p nil)
(defun _-blank-line-p (&optional arg1flag)
"
Optional ARG1, if non-nil, includes carriage returns as whitespace"
;;
(let (
lb-rc)
(save-match-data
(save-excursion
(if (not (string-match
;; 2007.07.17
;; (concat "[^ \t" (if arg1flag "\r") "]")
(if (not arg1flag) _-^whitespace-noM _-^whitespace-wM)
(buffer-substring-no-properties
(progn (beginning-of-line) (point))
(progn (end-of-line) (point)))))
(setq lb-rc t))))
lb-rc))
;; fix!
;; Make ARG1 a string so \r and/or ~ can be appended to regexp.
(progn
(defun _-move-forward-whitespace (&optional arg1flag-CR arg2jumpover)
"Calls _-move--whitespace
ARG1: include carriage returns as whitespace.
ARG2: ignore adjacent non-whitespace"
(interactive)
(_-move--whitespace "f" arg1flag-CR arg2jumpover))
(defun _-move-backward-whitespace (&optional arg1flag-CR arg2jumpover)
"Calls _-move--whitespace
ARG1: include carriage returns as whitespace.
ARG2: ignore adjacent non-whitespace"
(interactive)
(_-move--whitespace "b" arg1flag-CR arg2jumpover))
;; fix!
;; Allow ARG1 to be a string so \r and/or ~ can be appended to regexp.
;; (_-move--whitespace "f" nil nil)
;; (_-move--whitespace "f" t nil)
;; (_-move--whitespace "b" nil nil)
;; (_-move--whitespace "b" t nil)
(defun _-move--whitespace (&optional arg0dirn arg1flag-CR arg2flag)
"Similar to skip-chars-forward. Returns point instead of number of
characters skipped.
Optional ARG1, if non-nil, will include carriage returns as whitespace.
Optional ARG2, if non-nil, will skip over adjacent whitespace
even if point is not currently adjacent to a whitespace"
;;
(let (_-pt
(_-pt-beg (point))
_re-ws
_rc)
;; fix! skip-chars-backward is a built-in function.
(save-match-data
(setq _re-ws (if arg1flag-CR _-whitespaces-wM _-whitespaces-noM))
(cond ;; Point in middle of ^M-9 ???
((string= "f" arg0dirn)
;; Move forward to end regardless of ARG1.
(if (and t
(or
(and (looking-at "[-][0-9]+")
(setq _pt (match-end 0))
(looking-at-backward-become-forward "[\r]"))
(and (looking-at "[0-9]+")
(setq _pt (match-end 0))
(looking-at-backward-become-forward "[\r][-]"))))
(or (goto-char _pt)
t ;; Do undo the looking-at-backward-become-forward!!
)))
((string= "b" arg0dirn)
;; Move backward to beginning if ARG1 is non-nil.
;; If ARG1 is nil, all of "^M-9" is treated as non-whitespace.
(if (and arg1flag-CR
(or
(and (looking-at "[-][0-9]+")
(setq _pt (match-end 0))
(looking-at-backward-become-forward "[\r]"))
(and (looking-at "[0-9]+")
(setq _pt (match-end 0))
(looking-at-backward-become-forward "[\r][-]"))
(and t
(setq _pt (point))
(looking-at-backward-become-forward "[\r][-][0-9]+"))))
(or t ;; Do *NOT* undo the looking-at-backward-become-forward !
(goto-char _pt)
)))
(t (error "%s: %s" "Not 'b' or 'f'" arg0dirn)))
(cond ;; Use ARG2 to cheat?
((string= "f" arg0dirn)
(when (and arg2flag
(not (looking-at _re-ws)))
(sfr _re-ws)
;; May need to skipover "-9" after "^M".
(goto-char (match-beginning 0))))
;;
((string= "b" arg0dirn)
(when (and arg2flag
(not (looking-at-backward-become-forward _re-ws)))
(sbr _re-ws)))
(t t))
(cond ;; MAIN.
((string= "f" arg0dirn)
(while (looking-at _re-ws)
(setq _rc (goto-char (match-end 0)))
;; If ARG1 is t, point may be inbetween "^M" and "-9".
(if (and arg1flag-CR
(looking-at-backward-become-forward "[\r]"))
(if (looking-at "[\r][-][0-9]+")
(setq _rc (goto-char (match-end 0)))
(error "%s: %s" "Expecting -9" "after carriage-return")))))
;;
((string= "b" arg0dirn)
(while (looking-at-backward-become-forward _re-ws)
(setq _rc (point))
(and arg1flag-CR
(looking-at-backward-become-forward "[\r][-][0-9]+")
;; fix? Why cannot looking-at* return point instead of 't'?
(setq _rc (point)))))
(t t))
)
_rc))
);progn
;; (_-del-parens lb-re-bracketed-integer) => "[[]?[0-9]+[]]?"
(defun _-del-parens (arg1str)
""
(let ((_-rc arg1str))
(while (string-match "[\\][)(]" _-rc)
(setq _-rc (replace-match "" nil nil _-rc)))
_-rc))
(defun _-trailing-whitespacep (&optional arg1n2check arg2noninteractive)
"Check buffer for trailing whitespace at end of lines.
Does not check for trailing newline at end of lines (meaningless).
ARG1 is number of characters to check surrounding point, maybe less
if number of characters above/below point is less than half of ARG1.
ARG2 is flag that should be non-nil when called non-interactively"
;;
(interactive "p") ;; If no prefix argument, ARG1 will be 1.
(let (_-rc _-pt-above _-pt-below
(_-pt (point)))
(if (or (not arg1n2check)
(= 1 arg1n2check)) (setq arg1n2check 2000))
(save-match-data
(save-excursion
(forward-char (- 0 (min (/ arg1n2check 2) (- (point) (point-min)))))
(setq _-pt-above (point))
(setq _-rc (if (search-forward-regexp
"[ ]$" ;; space and tab, not newline.
(setq _-pt-below
(+ (point)
(min arg1n2check (- (point-max) (point)))))
t) t nil))))
(if arg2noninteractive
_-rc
(message "%s" (concat
(if _-rc "YES" "NO")
": Trailing whitespace found?"
" (checked "
(int-to-string (- _-pt _-pt-above)) "/"
(int-to-string (- _-pt-below _-pt)) " "
"characters above/below).")))))
;; (setq _rc "EDITIONS: en-2000 es-9999")
;; (setq _cons (cons 123 321))
;; (_-app '_rc _cons)
(defun _-app (arg1sym arg2item)
"Append non-list ARG2 to symbol ARG1 where ARG1 is a list"
;;
(let (
_-rc-_-app)
(set arg1sym
(append (symbol-value arg1sym)
(setq _-rc-_-app
(if (or (listp arg2item)
(consp arg2item)) arg2item
(list arg2item)))))
_-rc-_-app))
(defun _-exchange-symbol-values (arg1sym arg2sym)
""
;; (progn (setq a "a") (setq b "b") (_-exchange-symbol-values 'a 'b))
(let (_-1 _-2)
(setq _-1 (symbol-value arg1sym))
(setq _-2 (symbol-value arg2sym))
(set arg1sym _-2)
(set arg2sym _-1) nil))
(defun _-force-new-file (arg1pf)
"Find a file, deleting it beforehand if it exists"
;;
(let (_buff
_rc)
;; fix? use _-ifcl?
(if (setq _buff (find-buffer-visiting arg1pf))
(kill-buffer _buff))
(if (file-exists-p arg1pf)
(delete-file arg1pf))
(find-file-literally arg1pf)
(set-buffer-modified-p t)
_rc))
;; fix!
;; Change to _-let-hook and use return value (same as arg) to set lb-dfun.
;; (_-dfun-hook "lb-mu-spawn-taz-")
(defun _-dfun-hook (arg1 &optional arg2)
"Sets _-defun to ARG1.
Messages string ARG1 if lb-debug is true.
Optional ARG2, if non-nil, writes contents of buffer to
/tmp/.input-to--"
;;
(let (
(_-rc arg1))
(save-excursion
(save-match-data
(setq _-defun arg1)
(setq _defun arg1) ;; Switching from _-rc to _rc (etc.).
(if lb-debug (message (concat "INVOKING: " arg1)))
(if arg2 (write-region
(point-min) (point-max)
(concat (temp-directory) "/.input-to--" _defun)))
)) _-rc))
(defun _-dfun-hook-set (arg1p)
"Interactive function to ensure argument to _-dfun-hook is same
as defun name"
;;
(interactive "p")
(let (_-str)
(save-excursion
(goto-char (point-min))
(while (search-forward-regexp "(_-dfun-hook \"\\([^\" \t\n]*\\)\")" nil t)
(replace-match
(save-excursion
(save-match-data
(search-backward-regexp "[(]defun \\([^ \t\n\r]+\\)")
(match-string 1)))
t t nil 1)))))
(defun _-just-one-whitespace (&optional arg1flag) ;; UTILITY
"Delete all spaces and tabs AND NEWLINES around point, leaving one space.
Optional ARG1, if non-nil, includes carriage returns as whitespace"
;; (1.) Function "fixup-whitespace" does not treat NEWLINE as whitespace.
;; (2.) Just like function just-one-space, with "\n" inserted twice below:
;;
;; ~/www.marxists.org/archive/lenin/howto/tx2html.el
(interactive "*")
(skip-chars-backward (concat " \t\n" (if arg1flag "\r")))
(if (= (following-char) ? )
(forward-char 1)
(insert ? ))
(delete-region (point) (progn (skip-chars-forward
(concat " \t\n" (if arg1flag "\r")))
(point))))
(defun _-normalize-whitespace (arg1str &optional arg1flag)
"Normalize whitespace in string ARG1
Optional ARG1, if non-nil, includes carriage returns as whitespace"
;; ~/www.marxists.org/archive/lenin/howto/tx2html.el
;; (defun _-sgml-normalize-element
;;
(let (_-str)
(with-temp-buffer
(progn (insert arg1str) (goto-char (point-min)))
(while (< (point) (point-max))
(if (looking-at (if arg1flag _-whitespace-wM _-whitespace-noM))
(_-just-one-whitespace arg1flag)
(forward-char 1)))
(progn (goto-char (point-min))
(if (looking-at " ") (replace-match "")))
(progn (goto-char (point-max))
(if (< (skip-chars-backward " ") 0)
(delete-region (point) (1+ (point)))))
(setq _-str (buffer-string))) _-str))
;; (_-para) -> (";; (_-para) " 7646 . 7658)
;; (_-para t nil) ... strip leading + trailing blanks.
(defun _-para (&optional arg1trim arg2trim arg3trim__)
"Return cons cell with text of current paragraph and a
cons cell with point boundaries that may be used by _-para-delete
Optional ARG1 and ARG2 are passed to _-where-double-newlines to
ignore whitespace-ish characters at beginning of block.
Optional ARG3, if non-nil, deletes ___"
;;
(let (_-cons _-str
_-rc)
(save-match-data
(save-excursion
(goto-char (car (setq _-cons (_-where-double-newlines
arg1trim arg2trim))))
(setq _-str (buffer-substring-no-properties (car _-cons) (cdr _-cons)))
(setq _-rc
(list
(if (not arg3trim__)
_-str
(with-temp-buffer
(insert _-str)
(goto-char (point-min))
;; Interaction between arg1 and arg3:
(if (and arg3trim__ (looking-at
(concat _-re-__ _-whitespaces-wM)))
(replace-match ""))
(while (search-forward-regexp _-re-__ nil t)
(replace-match ""))
;;
(buffer-string)))))
(_-app '_-rc _-cons)))
_-rc))
;; fix!
;; rename using "pop"
(defun _-para-delete (&optional arg1trim arg2trim)
"Delete paragraph as surrounded by newlines and return deleted paragraph.
Optional ARG1 and ARG2 are passed to _-where-double-newlines.
SEE ALSO _-kill-paragraph in tx2html.el"
;;
(interactive)
(let (_-cons
_-rc)
(save-match-data
(if (_-blank-line-p t) (_-move-forward-whitespace t))
(setq _-rc (car (setq _-cons (_-para arg1trim arg2trim))))
(delete-region (car (cdr _-cons)) (cdr (cdr _-cons)))
;; 2006.11.23
;; Compress multiple newlines in this zone.
(progn
(_-move-backward-whitespace)
(if (looking-at "[ \t]+") (goto-char (match-end 0)))
;; Should be at first of two ... or more ... newlines.
(if (not (looking-at "[\n][ \t\r]*[\n]"))
(error "%s: %s" "Expecting" "two newlines")
(goto-char (match-end 0)))
;; Delete 3rd+ newlines.
(while (looking-at "[ \t\r]*[\n]") (replace-match "")))
(recenter)
)_-rc))
(defun _-ifcl (arg1FILENAME &optional arg2VISIT arg3BEG arg4END arg5REPLACE)
"Calls save-some-buffers before insert-file-contents-literally.
Runs _-find-file-hooks-__-globals
Leave point at min"
;;
(let (_-str _-buffer _rc)
(if (and (setq _-buffer (find-buffer-visiting arg1FILENAME))
(buffer-modified-p _-buffer)) (save-some-buffers))
;; 2006.08.22
(if (and (not (file-exists-p arg1FILENAME))
(string-match (concat "/" lb-file-db "$") arg1FILENAME))
(error "%s: %s"
"File not found (run lb.sh?)"
arg1FILENAME))
(insert-file-contents-literally
arg1FILENAME arg2VISIT arg3BEG arg4END arg5REPLACE)
;; _-where-page-numbers
(_-find-file-hooks-__-globals arg1FILENAME)
(goto-char (point-min))
_rc))
;;
(defun _-delete-paragraph-from-file (arg1re arg2pf)
"Edit file ARG2 in-place by removing paragraph with regexp ARG1"
;;
(with-temp-buffer
(_-ifcl arg2pf)
(goto-char (point-min))
(_-flush-one-paragraph arg1re nil nil)
(write-region (point-min) (point-max) arg2pf)))
(defun _-flush-one-paragraph (arg1re &optional arg2trim arg3trim)
"ARG1 is a regular expression; if found, delete paragraph.
A paragraph is surrounded by blank lines. See below.
Optional ARG2 and ARG3 are passed to _-where-double-newlines during
deletion.
Returns..."
;; (_-flush-one-paragraph "%%data%%")
(let (
_-rc)
(save-excursion
(save-match-data
(if (search-forward-regexp arg1re nil t)
(delete-region (car (setq _-rc
(_-where-double-newlines
arg2trim arg3trim)))
(cdr _-rc)))))
_-rc))
(defun _-current-time nil
"Uses lb-format-time-string"
;;
(format-time-string lb-format-time-string (current-time)))
;; (_-timestamp "~/leninist.biz/to-do")
;; (_-timestamp "~/leninist.biz/to-do" t)
(defun _-timestamp (&optional arg1pf arg2flag-short) ;; UTIL
"For optional path/file ARG1 return something like:
2005-01-10T14:18:08-0800 based upon lb-format-time-string.
If optional ARG2 is non-nil,make it short: YYMMDD_HHMM.
Optional ARG1 defaults to buffer-file-name.
SEE ALSO: _-current-time"
;;
(let (_bfn
_rc)
(if (and (not arg1pf)
(setq _bfn (buffer-file-name)))
(setq arg1pf _bfn))
(if (and arg1pf
(file-exists-p arg1pf))
(setq _rc
(format-time-string
(if (not arg2flag-short) lb-format-time-string
"%Y%m%d_%H%M")
(nth 5
(file-attributes
(if (nth 0 (file-attributes arg1pf))
(nth 0 (file-attributes arg1pf))
arg1pf))))))
_rc))
;;
(defun _-beginning-of-line (&optional arg1cr)
"Optional ARG1, if non-nil, recognizes carriage returns as
line breaks"
;;
(goto-char (_-endpoint-of-line "beginning" arg1cr)))
;;
(defun _-end-of-line (&optional arg1cr)
"Optional ARG1, if non-nil, recognizes carriage returns as
line breaks"
;;
(goto-char (_-endpoint-of-line "end" arg1cr)))
;;
(defun _-endpoint-of-line (arg1which &optional arg2cr)
"If optional ARG2 is nil, run SOMETHING-of-line where
SOMETHING is 'beg' or 'beginning' or 'end'.
If optional ARG2 is non-nil, allow carriage returns as
line breaks; this will increase beginning of line or decrease
end of line"
;;
(let (_pt
_rc)
(save-excursion
(save-match-data
(if (string= "beg" arg1which) (setq arg1which "beginning"))
(save-excursion
(cond
((string= "beginning" arg1which)
(beginning-of-line))
((string= "end" arg1which)
(end-of-line))
(t
(error "%s: %s" "Must be" "beginning OR end")))
(setq _pt (point)))
(when arg2cr
(cond
((string= "beginning" arg1which)
(if (sbr lb-re-cr-as-line-break _pt t)
(setq _rc (match-end 0))))
((string= "end" arg1which)
(if (sfr lb-re-cr-as-line-break _pt t)
(setq _rc (match-beginning 0))))))
(if (not _rc) (setq _rc _pt))
)) _rc))
(defun _-current-line (&optional arg1trim-lead arg2trim-tail arg3cr)
"Return line in buffer with point.
Optional ARG1, if non-nil, trims leading whitespace.
Optional ARG1, if non-nil, trims trailing whitespace
Optional ARG1, if non-nil, uses carriage returns as line breaks"
;;
(let (
_-rc)
;; fix! 2007.11.22 - arg to treat ^M as line breaks.
(setq _-rc (buffer-substring-no-properties
(save-excursion (_-beginning-of-line arg3cr)
(point))
(save-excursion (_-end-of-line arg3cr)
(point))))
(if (and arg1trim-lead
(string-match (concat "^" _-whitespaces-wM) _-rc))
(setq _-rc (replace-match "" nil nil _-rc 0)))
(if (and arg2trim-tail
(string-match (concat _-whitespaces-wM "$") _-rc))
(setq _-rc (replace-match "" nil nil _-rc 0)))
_-rc))
(defun _-set-buffer-to-pf (arg1pf)
"Save some buffers; find file literally; fundamental mode; read-only"
(_-dfun-hook "_-set-buffer-to-pf")
;;
(let (_-buffer)
(if (and (setq _-buffer (find-buffer-visiting arg1pf))
(buffer-modified-p _-buffer))
(error "%s: %s" "Already visiting modified buffer" arg1pf))
;;;(defun insert-file-contents-literally (filename &optional visit beg end replace)
;;; "Like `insert-file-contents', but only reads in the file literally.
;;;A buffer may be modified in several ways after reading into the buffer,
;;;to Emacs features such as format decoding, character code
;;;conversion, find-file-hooks, automatic uncompression, etc.
;;;
;;;This function ensures that none of these modifications will take place."
;;; (let ((format-alist nil)
;;; (after-insert-file-functions nil)
;;; (coding-system-for-read 'no-conversion)
;;; (coding-system-for-write 'no-conversion)
;;; (jka-compr-compression-info-list nil)
;;; (find-buffer-file-type-function
;;; (if (fboundp 'find-buffer-file-type)
;;; (symbol-function 'find-buffer-file-type)
;;; nil)))
;;; vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
;;; 't' is rawfile
;;; (find-file-noselect filename nil t)
;;; (find-file-noselect-1 buf filename nowarn
;;; rawfile truename number)
;;; (if rawfile
;;; (condition-case ()
;;; (insert-file-contents-literally filename t)
;;;This does code conversion according to the value of
;;;`coding-system-for-read' or `file-coding-system-alist',
;;;and sets the variable `last-coding-system-used' to the coding system
;;;actually used.
;;;
;;;(insert-file-contents FILENAME &optional VISIT BEG END REPLACE)
;;; ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
;; (find-file-literally arg1pf)
;;
(find-file arg1pf)
;; (setq buffer-file-coding-system 'iso-latin-1-unix)
;;; This variable is never applied to a way of decoding
;;; a file while reading it.
(fundamental-mode)
(toggle-read-only t)
(set-buffer (current-buffer))))
(defun _-something-to-list (&optional arg1-or-buf-pf-str arg2-is-pf)
"Chop ARG1 (buffer) (or file) (or string) into pieces delimited by blank lines.
ARG1 is optional (uses current buffer if nil).
If no blank lines chop by newlines.
Optional ARG2, if non-nil, says to treat ARG1 as a pathfile string."
;; (_-something-to-list "")
(let (_-rc _-pf _-cons (_-buffer-was-current (current-buffer)))
;;
(when (stringp arg1-or-buf-pf-str)
(if (and arg2-is-pf (not (file-exists-p arg1-or-buf-pf-str)))
(error "%s: %s" "File not found" arg1-or-buf-pf-str))
(setq _-pf (if (and (not (string= "" arg1-or-buf-pf-str))
;; !!!!! (file-exists-p "") => t
(file-exists-p arg1-or-buf-pf-str)) arg1-or-buf-pf-str
(concat (temp-directory) "/" (make-temp-name ""))))
(if (not (file-exists-p _-pf))
(with-temp-buffer
(insert arg1-or-buf-pf-str)
(write-region (point-min) (point-max) _-pf)))
(set-buffer (_-set-buffer-to-pf _-pf)))
;;
(goto-char (point-min))
;; Buffer has a blank line:
(if (and (save-excursion (search-forward-regexp "\n[ \t]*\n" nil t))
(if (not (string-match (concat ".tab") _-pf))
t
(error "%s: %s" "Blank line in tab file" _-pf)))
;;
(while (search-forward-regexp "[^ \t\n\r]" nil t)
(setq _-rc (append _-rc
(list
(buffer-substring-no-properties
(car (setq _-cons (_-where-double-newlines)))
(cdr _-cons)))))
(goto-char (cdr _-cons)))
;; No blank line: assume each line is a record.
(while (< (point) (point-max))
(if (not (looking-at "^[ \t]*[#]"))
(setq _-rc (append _-rc (list (_-current-line)))))
(end-of-line) (forward-char 1)))
;;
(when _-pf
(if (not (file-exists-p arg1-or-buf-pf-str)) (delete-file _-pf))
(kill-buffer (current-buffer))
(set-buffer _-buffer-was-current))
_-rc))
(defun _-comma-ify-int (arg1int)
""
;; (_-comma-ify-int 1)
;; (_-comma-ify-int 12)
;; (_-comma-ify-int 123)
;; (_-comma-ify-int 1234)
;; (_-comma-ify-int 12345)
;; (_-comma-ify-int 123456)
;; (_-comma-ify-int 1234567)
;; (_-comma-ify-int 12345678)
;; (_-comma-ify-int 123456789)
(let (my my-rc my-chunk)
(if (not (integerp arg1int))
arg1int
(setq my (int-to-string arg1int))
(while (< 3 (length my))
(setq my-chunk (substring my (- (length my) 3)))
(setq my (substring my 0 (- (length my) 3)))
(setq my-rc (concat
(if (< 0 (length my)) "," "") my-chunk my-rc)))
(if (< 0 (length my))
(concat my "" my-rc)
my-rc))))
(defun _-re-del-emacs (arg1str)
"Delete emacs-ish stuff from string"
;; (_-re-del-emacs "\\([12][0-9][0-9][0-9]\\|9990\\|9999\\)")
(let (my)
(while (string-match "[\\\\]\\([)|(]\\)" arg1str)
(setq arg1str (replace-match (match-string-no-properties 1 arg1str)
nil nil arg1str))))
arg1str)
;; fix!
;; Replace all " \t\n" in code with one of these variables.
;; fix!
;; By default, \r (^M) is part of whitespace.
;; Need one that excludes \r when dealing with .tx files.
;; fix?
;; What about "~"?
;;; TO lb-defvar.el :
;;; 1102:(defvar _-punct-from-keyboard ;; (_makunbound)
;;; 1110:(defvar _-whitespace-wM ;; (_makunbound)
;;; 1112:(defvar _-whitespace-noM ;; (_makunbound)
;;; 1115:(defvar _-^whitespace-wM ;; (_makunbound)
;;; 1117:(defvar _-^whitespace-noM ;; (_makunbound)
;;; 1120:(defvar _-whitespaces-wM ;; (_makunbound)
;;; 1122:(defvar _-whitespaces-noM ;; (_makunbound)
;;; 1125:(defvar _-^whitespaces-wM ;; (_makunbound)
;;; 1127:(defvar _-^whitespaces-noM ;; (_makunbound)
;;; 1130:(defvar _-usr_share_sgml_html_dtd_xml_1.0_*.ent ;; (_makunbound)
;;; 1135:(defvar _-re-__ ;; (_makunbound)
(defun _-ws (arg1list)
"Change whitespaces to whitespace REGEXPs"
;; (_-ws "
")
;; fix! Why the newline in: (_-ws "1") -> "[\n]?1"
(let (t2h-char (t2h-return-value "[\n]?") (t2h-flag t))
(if (stringp arg1list) (setq arg1list (list arg1list)))
(loop for elem in arg1list
do
(loop for i from 0 to (1- (length elem))
do
(setq t2h-char (substring elem i (1+ i)))
(if (not (string-match "[ \t\n\r]" t2h-char))
(progn
(setq t2h-return-value (concat t2h-return-value t2h-char))
(setq t2h-flag t))
(if t2h-flag
(setq t2h-return-value (concat t2h-return-value "[ \t\n\r]*")))
(setq t2h-flag nil)
))) t2h-return-value))
;; (_-lowercase-before-optnumber-p "STR123iii")
;; (_-lowercase-before-optnumber-p "StR123iii")
(defun _-lowercase-before-optnumber-p (arg1str)
"Is there a lowercase letter before optional number in string ARG1"
(let (rc (i 0) str)
(while (< i (length arg1str))
(setq str (substring arg1str i (1+ i)))
(when (string-match "[0-9]" str)
(setq i (1+ (length arg1str))))
(when (member str (split-string lb-az ""))
(setq rc t)
(setq i (1+ (length arg1str))))
(setq i (1+ i))) rc))
(defun _-append-to-buffer (arg1buf arg2beg arg3str)
"After inserting ARG3, do append-to-buffer where END = point +
length ARG3, then delete ARG3"
;;
(let (_-pf)
(save-excursion (insert arg3str))
(append-to-buffer arg1buf arg2beg (+ (point) (length arg3str)))
(delete-region (point) (+ (point) (length arg3str)))))
(defun _-tex2unibyte (&optional arg1)
""
;; (with-temp-buffer (insert "\æ") (message (_-tex2unibyte)))
;; (with-temp-buffer (insert "\á\é\í\ó\ú") (message (_-tex2unibyte)))
;; (with-temp-buffer (insert "\à\è\ì\ò\ù") (message (_-tex2unibyte)))
;; (with-temp-buffer (insert "\\ä\\ë\\ï\\ö\\ü") (message (_-tex2unibyte)))
(interactive "p")
(if arg1 (standard-display-european t))
(let (_-pf _-msnp1 _-msnp2)
(save-match-data
(save-excursion
(goto-char (point-min))
(while (search-forward-regexp
(concat "[\\]\\(["
"a'`~\"" ;; may change.
"]\\)\\(["
"AEIONUYaeiou" ;; may change.
"]\\)")
nil t)
(setq _-msnp1 (match-string-no-properties 1))
(setq _-msnp2 (match-string-no-properties 2))
(if (string= "'" _-msnp1)
(replace-match
(char-to-string
(cond
((string= "a" _-msnp2) 225)
((string= "e" _-msnp2) 233)
((string= "i" _-msnp2) 237)
((string= "o" _-msnp2) 243)
((string= "u" _-msnp2) 250)
((string= "y" _-msnp2) 253)
((string= "A" _-msnp2) 193)
((string= "E" _-msnp2) 201)
((string= "I" _-msnp2) 205)
((string= "O" _-msnp2) 211)
((string= "U" _-msnp2) 218)
((string= "Y" _-msnp2) 221))))
(if (string= "`" _-msnp1) ;; NOTE: no "ygrave" or "Ygrave"
(replace-match
(char-to-string
(cond
((string= "a" _-msnp2) 224)
((string= "e" _-msnp2) 232)
((string= "i" _-msnp2) 236)
((string= "o" _-msnp2) 242)
((string= "u" _-msnp2) 249)
((string= "A" _-msnp2) 192)
((string= "E" _-msnp2) 200)
((string= "I" _-msnp2) 204)
((string= "O" _-msnp2) 210)
((string= "U" _-msnp2) 217))))
(if (string= "\"" _-msnp1)
(replace-match
(char-to-string
(cond
((string= "a" _-msnp2) 228)
((string= "e" _-msnp2) 235)
((string= "i" _-msnp2) 239)
((string= "o" _-msnp2) 246)
((string= "u" _-msnp2) 252)
((string= "y" _-msnp2) 255)
((string= "A" _-msnp2) 196)
((string= "E" _-msnp2) 203)
((string= "I" _-msnp2) 207)
((string= "O" _-msnp2) 214)
((string= "U" _-msnp2) 220)
((string= "Y" _-msnp2) 376)))) ;; oddball
(if (string= "~" _-msnp1)
(replace-match
(char-to-string
(cond
((string= "A" _-msnp2) 195)
((string= "N" _-msnp2) 209)
((string= "O" _-msnp2) 213)
((string= "a" _-msnp2) 227)
((string= "n" _-msnp2) 241)
((string= "o" _-msnp2) 245))))
(if (string= "a" _-msnp1)
(replace-match
(char-to-string
(cond
;; fix?
;; eth?
;; thorn?
((string= "e" _-msnp2) 230)
)))))))))))
;; be sure to return nil so can be used on write-file-hooks
nil))
;; (setq _-pf "~/leninist.biz/en/html/htmm/../../../en/../default.css")
;; (command-line-normalize-file-name-then-some _-pf)
(defun command-line-normalize-file-name-then-some (file)
"Collapse multiple slashes to one, to handle non-Emacs file names
Also removes embeded '/./'."
(let (_-end)
(save-match-data
;; Use arg 1 so that we don't collapse // at the start of the file name.
;; That is significant on some systems.
;; However, /// at the beginning is supposed to mean just /, not //.
(if (string-match "^///+" file)
(setq file (replace-match "/" t t file)))
(while (string-match "//+" file 1)
(setq file (replace-match "/" t t file)))
;; June 2005.
(while (string-match "/[.]/" file 1)
(setq file (replace-match "/" t t file)))
;; July 2005: Change "/../en/../" to "/../"
(setq _-end 1)
(while (string-match "/[.][.]\\(/[^/]+\\)/[.][.]/" file _-end)
(setq _-end (match-beginning 1))
(if (not (string= "/.." (match-string 1 file)))
(setq file (replace-match "/../" t t file))))
;; March 2006: Replace "/abc/../" with "/".
;; March 2006: Replace "/abc/.." at end of string with "/".
(progn
(while (string-match "/[^/]+/[.][.]/" file)
(setq file (replace-match "/" t t file)))
(while (string-match "/[^/]+/[.][.]$" file)
(setq file (replace-match "/" t t file))))
;;
)
file))
(defun _-compress-delete-whitespaces (&optional arg1str arg2__flag)
"Compress whitespaces and delete trail/ending whitespace(s).
Optional ARG2, if non-nil, removes __TAG__ tags"
;; (_-compress-delete-whitespaces " \tABC \n \n XYZ \t")
;; (_-compress-delete-whitespaces " \tABC \n \n __FOO__ XYZ \t")
;; (_-compress-delete-whitespaces " \tABC \n \n __FOO__ XYZ \t" nil)
;; (_-compress-delete-whitespaces " \tABC \n \n __FOO__ XYZ \t" t)
(save-match-data
(let (REGEXP NEWTEXT _-pf
(_-pairs (list (cons
(if (and (boundp 'arg2__flag)
(not (null arg2__flag)))
_-re-__ " ") " ")
(cons "\n" " ")
(cons "\t" " ")
(cons "\r" " ")
(cons " [ ]+" " ")
(cons "^[ ]+" "")
(cons "[ ]+$" ""))))
(if arg1str
(with-temp-buffer
(insert arg1str)
;;
(_-replace-regexp _-pairs)
;;
(buffer-string))
(while _-pairs
(goto-char (point-min))
;;
(_-replace-regexp _-pairs)
;;
(setq _-pairs (nthcdr 1 _-pairs)))))))
(defun _-replace-regexp (arg1conslist &optional arg2dir arg3rebound)
""
;; (describe-function 'replace-regexp)
;; ...
;;This function is usually the wrong thing to use in a Lisp program.
;;What you probably want is a loop like this:
;; (while (re-search-forward REGEXP nil t)
;; (replace-match TO-STRING nil nil))
;;which will run faster and will not set the mark or print anything.
;; (_-replace-regexp (list (cons " " " ")) t 240)
;; MEANS: search-backward from (point-max) changing tabs after 240 to spaces.
(let (_-search-dir-regexp (_-pairs arg1conslist))
(save-excursion
(save-match-data
(defalias '_-search-dir-regexp
(if arg2dir (symbol-function 'search-backward-regexp)
(symbol-function 'search-forward-regexp)))
(while _-pairs
(goto-char (if arg2dir (point-max) (point-min)))
;;
;;(replace-regexp (car (car _-pairs)) (cdr (car _-pairs)))
(setq NEWTEXT (cdr (car _-pairs)))
(if (< 0 (length (setq REGEXP (car (car _-pairs)))))
(while (_-search-dir-regexp
REGEXP (if arg3rebound
(if (integerp arg3rebound) arg3rebound
(save-excursion
(_-search-dir-regexp
arg3rebound nil t))) nil) t)
(replace-match NEWTEXT t t)))
(setq _-pairs (nthcdr 1 _-pairs)))))))
(defun _-cda (arg1str arg2sym)
"cdr ... assoc ... ARG1 ARG2
where ARG1 is a string and ARG2 is a symbol"
;; (_-cda "en" lb-mu-template-authors)
(cdr (assoc arg1str arg2sym)))
(defun _makunbound nil
""
(let (
(_re-defvar "defvar[ \t]+")
(_eol (save-excursion (end-of-line) (point)))
_rc)
(save-excursion
(save-match-data
(beginning-of-line)
(if (and (or (search-forward-regexp _re-defvar _eol t)
(search-backward-regexp _re-defvar nil t))
(goto-char (match-end 0)))
(if (and (search-forward-regexp "[^ \t\n]+")
(setq _rc (match-string-no-properties 0)))
(makunbound (intern _rc))))))
_rc))
(defun _-string-to-int (arg1 &optional arg2nth) ;; UTILITY
"Extract number as integer from string with digits.
.
Optional ARG2 skips over first ARG2 integers embedded in ARG1"
;; (_-string-to-int "sss111alsfjd" ) => "111"
;; (_-string-to-int "sss111alsfjd" 0) => "111"
;; (_-string-to-int "sss111als99fjd" 1) => "99"
(let ((t2h-foo arg1)
(t2h-nth (if arg2nth arg2nth 0))
_rc)
(save-match-data
(if (null arg1)
(setq _rc arg1)
(if (not (string-match "[0-9]" arg1))
(setq _rc arg1)
(loop for i from 1 to t2h-nth
do
(progn (string-match "\\([0-9]+\\)" t2h-foo)
(setq t2h-foo (replace-match "" nil nil t2h-foo))))
(progn (string-match "\\([0-9]+\\)" t2h-foo)
(setq _rc (string-to-number (match-string 1 t2h-foo)))))))
_rc))
(defun _-file-bytes (arg1pf)
""
(nth 7 (file-attributes arg1pf)))
(defun _-file-seconds (arg1pf)
""
;; (format-time-string "%s" nil) => "1121313967"
(if (file-exists-p arg1pf)
(string-to-int (format-time-string "%s" (nth 5 (file-attributes arg1pf))))
(error "%s: %s" "File not found (lb.sh turned off in crontab?)" arg1pf)))
(defun _-compress-multiple-spaces (&optional arg1beg arg2end)
""
(let (
(arg2adjust 0)
_rc)
(save-excursion
(save-match-data
(goto-char (if arg1beg arg1beg (point-min)))
(while (search-forward-regexp " +" (if arg2end
(- arg2end arg2adjust))
t)
(setq arg2adjust
(+ arg2adjust -1 (length (match-string-no-properties 0))))
(replace-match " "))))
_rc))
(defun _-compress-multiple-markup (&optional arg1tagname)
""
;;
(interactive)
(let (_re _tag
(_tagnames (list "em" "b"))
(_inbetween (concat
_-whitespaces-wM
"\\(
" _-tabspace-wM "*\\)?"))
_rc)
(save-excursion
(save-match-data
;; fix: make this a "hook" to be run at beg. of lots of functions.
(if (_-blank-line-p) (_-move-forward-whitespace)
(goto-char (car (wdn))))
;;
(loop for tag in _tagnames
do
(setq _re (concat _re "\\|" tag ">" _inbetween "<" tag ">")))
(setq _re (concat "\\("
(substring _re (string-match "<" _re)) "\\)"))
(while (and (sfr _re (cdr (wdn)) t)
(goto-char (match-beginning 0))
(sfr "\\([^>]+\\)>")
(setq _tag (match-string-no-properties 1)))
(replace-match "")
(sfr (concat "<" _tag ">"))
(replace-match ""))))
(message "%s" _re)
_rc))
(defun _-compress-multiple-newlines nil ;; UTILITY
"Compress two or more blank lines into one blank line"
(interactive "*")
;; fix! Delete all blank lines immediately after open P tag.
(save-excursion
;; Handle two newlines at top of buffer specially:
(progn
(goto-char (point-min))
(while (looking-at "\n[ \t\r]*\n")
(replace-match "\n" t t) (goto-char (point-min))))
(while (or (search-forward-regexp
(concat "\n[ \t\r]*" _-regexp-separator-para) nil t)
(search-backward-regexp
(concat "\n[ \t\r]*" _-regexp-separator-para) nil t))
;; (if t2h-flag-loop-message (t2h-log "WHILE _-compress-multiple-newlines"))
(replace-match "\n\n" t t))))
(defun _-find-to-list (arg1cmd &optional arg2where)
""
;; (_-find-to-list " -name .index") => ("~/leninist.biz/stf/.index"
;; (_-find-to-list " -type d") => ("~/leninist.biz/"
;; (interactive "p")
(let (_-pf (_-rc (list)))
(with-temp-buffer
(shell-command (concat "find " (if arg2where arg2where lb-home)
arg1cmd) t)
(goto-char (point-min))
(while (search-forward "\n" nil t)
(save-excursion
(forward-char -1)
(setq _-pf (buffer-substring-no-properties
(save-excursion (beginning-of-line) (point))
(point))))
(setq _-rc (append _-rc (list _-pf)))))
_-rc))
(defun _-mail (arg1recip arg2subj arg3pf)
"Send mail message"
;; (_-mail lb-mail-recipient file-stamp my-temp-name)
(let (_-buffer)
(with-temp-buffer
(setq _-buffer (buffer-name))
(shell-command (concat "mail "
"-s " arg2subj " "
arg1recip
" < " arg3pf)
_-buffer nil))))
;; (_-capitalize-cdata " id='ABCD' ")
;; (_-capitalize-cdata "id='ABCD' ")
;; (_-capitalize-cdata "ABCD")
;; (_-capitalize-cdata ""ABCD")
;; (_-capitalize-cdata "AB\\\"UCD")
(defun _-capitalize-cdata (arg1str)
""
(let (_-pt _-flag
_-rc)
(with-temp-buffer
(insert arg1str)
(goto-char (point-max))
(while (forward-word -1)
(setq _-pt (point))
(setq _-flag t)
;; id="Abcde"
(goto-char _-pt)
(if (and (> (point) 1)
(or (forward-char -1) t)
(looking-at "[ \t\n\r][a-zA-Z]+[=][\"']"))
(setq _-flag nil))
;;
(goto-char _-pt)
(if (and (> (point) 2)
(or (forward-char -2) t)
(looking-at "[a-zA-Z]+>"))
(setq _-flag nil))
;; \"u
(progn
(goto-char _-pt)
(if (and (> (point) 2)
(or (forward-char -2) t)
(looking-at "[\\][\"'`~^]")) ;; AB\"UCD
(setq _-flag nil))
(goto-char _-pt)
;; If there is a letter to left of '\"u' then downcase this word.
(if (and (> (point) 3)
(or (forward-char -3) t)
(looking-at "[a-zA-Z][\\][\"'`~^]") ;; AB\"UCD
(or (goto-char _-pt) t))
(downcase-word 1)))
;;
(goto-char _-pt)
(if (and (> (point) 1)
(or (forward-char -1) t)
(looking-at "<[a-zA-Z]+[ \t\n\r>]"))
(setq _-flag nil))
;; "
(goto-char _-pt)
(if (and (> (point) 1)
(or (forward-char -1) t)
(looking-at "[&][a-zA-Z0-9]+;"))
(setq _-flag nil))
(progn (goto-char _-pt)
(if _-flag (capitalize-word 1))
(goto-char _-pt)))
(setq _-rc (buffer-string)))
_-rc))
(defun _-downcase-nonsignifs (arg1str &optional arg2list)
"Change certain non-significant words to downcase.
Optional ARG2 is a list of non-significant words to use.
Use _-normalize-whitespace beforehand to remove whitespace from ends"
;;
;; (_-downcase-nonsignifs "Firstword Of Secondword Of Fini.")
;; (_-downcase-nonsignifs "The Firstword And Secondword \rOf Fini.")
;; (_-downcase-nonsignifs "Firstword And Secondword Of Fini." '("OF"))
(let (i len
(_-rc arg1str))
(loop for w in (if arg2list arg2list '("OF" "AND" "THE"))
do
(setq i (1- (setq len (length _-rc))))
(while (> i 0) ;; Do not change first word, was: (> i -1)
(if (and
;; When doing substring, do not exceed length of _-rc.
(<= (+ i (length w)) (length _-rc))
(string= (upcase w)
(upcase (substring _-rc i (+ i (length w)))))
;; Start of string or character to left must not be alpha.
;; TeX is nice: right-most character is always alpha.
;; SGML named entities not-so-nice: right-most character is ';'.
(if (= i 0)
t
(not (string-match "[a-zA-Z]"
(substring _-rc (1- i) i))))
;; End of string or character to right must not be alpha.
(if (= (+ i (length w)) (length _-rc))
t
;; Include backslash and assume it's a TeX accented letter.
(not (string-match "[a-zA-Z\\]"
(substring _-rc
(+ 0 (+ i (length w)))
(+ 1 (+ i (length w))))))))
(setq _-rc (concat
(substring _-rc 0 i)
(downcase w)
(substring _-rc (+ i (length w))))))
(setq i (1- i))))
_-rc))
(defun _-write-hooks-clear (arg1p)
""
(interactive "p")
;; make-variable-buffer-local is an interactive built-in function.
;; Using `set' or `setq' to set the variable causes it to have a separate
;; value for the current buffer if it was previously using the default
;; value.
(setq write-contents-hooks nil)
(setq local-write-file-hooks nil)
(setq write-file-hooks nil))
(defun _-describe-function nil
""
(interactive)
(let (_rc)
(when (function-called-at-point)
(setq _rc t)
(setq _rc (describe-function (function-called-at-point))))
_rc))
;;
(defun __handler (arg1action arg2var &optional arg3str)
"Manipulates array lb-ht-__.
ARG1 is 'PUT' or 'GET' or 'DEL'.
ARG2 is name of slot (a string).
Optional ARG3 is string to store in named slot when ARG1 is 'PUT'"
;; (__handler "PUT" "FOO1" "xyyz") => "PUT"
;; (__handler "GET" "FOO1") => "xyyz"
;; (__handler "GET" "FOO1" t) => ("__FOO1__" . "xyyz")
;; (__handler "DEL" "FOO1") => "DEL"
(let (lb-str lb-existing
lb-rc)
(if (not (string-match _-re-__ arg2var)) ;; Accept 'FOO' for ARG2.
(setq arg2var (concat "__" arg2var "__")))
(if (string= "PUT" (upcase arg1action))
(and (or (setq lb-existing (__handler "GET" arg2var t)) t)
(or (setq lb-ht-__ (delete lb-existing lb-ht-__)) t)
(if (stringp arg3str)
(and (setq lb-ht-__ (append (list (cons arg2var arg3str))
lb-ht-__))
arg1action)))
(if (string= "GET" (upcase arg1action))
(and (or (setq lb-existing (assoc arg2var lb-ht-__)) t)
(if arg3str lb-existing (cdr lb-existing)))
(if (string= "DEL" (upcase arg1action))
(and (or (__handler "PUT" arg2var) t)
arg1action)
(error "%s: %s" "Invalid ARG1" arg1action))))
lb-rc))
(defun _makunbound nil
""
(let (_-str (_-eol (save-excursion (end-of-line) (point))))
(save-excursion
(beginning-of-line)
(if (search-forward-regexp "defvar[ \t]+" _-eol t)
(if (and (search-forward-regexp "[^ \t\n]+")
(setq _-str (match-string-no-properties 0)))
(makunbound (intern _-str)))))))
(defun _-something-to-string (arg1 arg2) ;; UTILITY
""
(if (stringp arg2) (setq arg2 (string-to-number arg2)))
(format arg1 arg2))
(defun _-number-to-alphas (arg1) ;; UTILITY
"(_-number-to-alphas 44) => \"ar\""
;;
(concat
(if (> (/ (- arg1 1) 26) 0)
(char-to-string (+ 96 (/ (- arg1 1) 26))))
(char-to-string (+ 96 (+ 1 (mod (- arg1 1) 26))))))
(defun _-string-to-int (arg1 &optional arg2nth) ;; UTILITY
"Extract number as integer from string with digits.
.
Optional ARG2 skips over first ARG2 integers embedded in ARG1"
;; (_-string-to-int "sss111alsfjd" ) => 111
;; (_-string-to-int "sss111alsfjd" 0) => 111
;; (_-string-to-int "sss111als99fjd" 1) => 99
;; (_-string-to-int "-3-" ) => 3
;; (_-string-to-int "-3" ) => -3
(let ((t2h-arg1 arg1)
(t2h-nth (if arg2nth arg2nth 0))
_rc)
;; fix? use (cond ?
(if (null arg1)
arg1
(if (not (string-match "[0-9]" arg1))
arg1
;; Not null, and has an integer.
;; Maybe skip over ARG2 integers.
(loop for i from 1 to t2h-nth
do
(progn (string-match "\\([0-9]+\\)" t2h-arg1)
(setq t2h-arg1 (replace-match "" nil nil t2h-arg1))))
;; MAIN:
(progn
(string-match
;; 2006.11.23
;; "-1" = 1, however, page number in .tx file may be: -1-
;; "\\([0-9]+\\)"
(concat
"\\([-]\\)?"
"\\([0-9]+\\)"
"\\([-]\\)?"
)
t2h-arg1)
;; 2006.11.23
;; (string-to-number (match-string 1 t2h-arg1))
(setq _rc (string-to-number (match-string 2 t2h-arg1)))
(if (and
;; "-" before integer.
(match-string 1 t2h-arg1)
;; No "-" after integer.
(not (match-string 3 t2h-arg1)))
(setq _rc (- 0 _rc))))))
_rc))
(defun _-int-add-length (arg1symbol arg2str)
""
;; (_-int-add-length 't2h-close-beg t2h-string)
(let (t2h-letx)
(set arg1symbol
(+ (symbol-value arg1symbol) (length arg2str)))))
(defun _-ws (arg1list)
"Change whitespaces to whitespace REGEXPs"
;; (_-ws "
")
;; fix! Why the newline in: (_-ws "1") -> "[\n]?1"
(let (t2h-char (t2h-return-value "[\n]?") (t2h-flag t))
(if (stringp arg1list) (setq arg1list (list arg1list)))
(loop for elem in arg1list
do
(loop for i from 0 to (1- (length elem))
do
(setq t2h-char (substring elem i (1+ i)))
(if (not (string-match "[ \t\n]" t2h-char))
(progn
(setq t2h-return-value (concat t2h-return-value t2h-char))
(setq t2h-flag t))
(if t2h-flag
(setq t2h-return-value (concat t2h-return-value "[ \t\n]*")))
(setq t2h-flag nil)
))) t2h-return-value))
;; (_-string-trim " 1 a b 2 ") => "1 a b 2"
;; (_-string-trim " 1 a b 2 " " \t\n2") => "1 a b 2"
(defun _-string-trim (arg1str &optional arg2re_chars)
"Remove leading and trailing whitespace"
(let ((t2h-return-value arg1str))
(if (not arg2re_chars)
(setq arg2re_chars " \t\n\r"))
;; Delete leading whitespace.
;; Delete trailing whitespace.
(if (string-match (concat
"^[" arg2re_chars
"]+\\([^" arg2re_chars
"].*\\)")
t2h-return-value)
(setq t2h-return-value (match-string 1 t2h-return-value)))
(if (string-match (concat
"\\(.*[^" arg2re_chars
"]\\)[" arg2re_chars
"]+$")
t2h-return-value)
(setq t2h-return-value (match-string 1 t2h-return-value)))
t2h-return-value))
;; (_-lvl-markup-p)
(defun _-lvl-markup-p ()
"Is point in a word that is either a LVL paragraph or
a H9 with a LVL class?"
(let (
_rc)
(save-excursion
(save-match-data
(if
(or
(and
;; Paragraph begins with LVL marker.
(string-match (concat "^" lb-re-__-lvl)
(car (_-para)))
;; Point before first whitespace.
(save-excursion
(sbr _-whitespace-wM)
(looking-at (concat "[\n]" lb-re-__-lvl))))
;; inside class= _> inside H9 tag.
(and (_-sgml-markup-p)
(sbs "\"" (save-excursion (sbs "<" nil t))
t)
(looking-at (concat "\"" lb-re-__-lvl-root "[0-9]" "\""))))
(setq _rc t))
)) _rc))
(defun _-where-double-newlines (&optional arg1trim arg2trim)
"Return point after preceeding NL-WS*-NL and point before next NL-WS*-NL.
If point near top (only whitespace above) or bottom (only whitespace
below) of buffer, point will be first non-whitespace from either end.
Optional ARG1, if non-nil, ignores leading tabs, spaces, CRs at beginning of block
Optional ARG2, if non-nil, ignores trailing tabs, spaces, CRs at end of block"
;; ~/www.marxists.org/archive/lenin/howto/tx2html.el
(let (_-pt-upper _-pt-lower _-char _-pt
(para-sep-regexp "\n[ \t\r]*\n")
_-rc)
(save-match-data
;; Abort if point is in blank line; let calling function deal with it.
(if (and (string-match "^[ \t]*$" (_-current-line))
(not (= 1 (point))))
(error "%s: %s" "Does not work with point"
(concat "on blank line"
"\n"
(_-buffer-substring-from-))
)
(save-excursion
(setq _-pt-upper (if (search-backward-regexp para-sep-regexp nil t)
(search-forward-regexp para-sep-regexp)
;; buffer may be empty:
(goto-char (point-min))
(if (setq _-pt
(search-forward-regexp
;; fix ?!?! Should below be "-noM"?
;; fix ?!?! Should below be "-noM"?
_-^whitespace-wM nil t))
(1- _-pt))
))
(save-excursion
(setq _-pt-lower
(if (search-forward-regexp para-sep-regexp nil t)
(progn
(search-backward-regexp para-sep-regexp)
;; Do not want two ^M in a row.
(if (looking-at "[\n][ \t]*[\r]")
(error "%s: %s"
(concat "On page " (lb-tx-what-page)
", two CR in a row, or nothing to left")
(concat "\n\n" (_-buffer-substring-from-))
))
(point))
(goto-char (point-max))
;; buffer may be empty:
(if (setq _-pt
(search-backward-regexp
;; fix ?!?! Should below be "-noM"?
_-^whitespace-wM nil t))
(1+ _-pt))
))
(if arg1trim
(save-excursion (goto-char _-pt-upper)
;; Added \n\r (2006.04.25) to fix bug when
;; in paragraph at top of file b/c just one
;; newline above.
(if (looking-at "[ \t\n\r]+")
(setq _-pt-upper (match-end 0)))))
(if arg2trim
(save-excursion (goto-char _-pt-lower)
(if (_-move-backward-whitespace arg2trim)
(setq _-pt-lower (point)))))))))
(setq _-rc
(if (and _-pt-upper (not _-pt-lower))
(error "%s: %s" "Got point upper" "but not point lower")
(if (and (not _-pt-upper) _-pt-lower)
(error "%s: %s" "Got point lower" "but not point upper")
(cons _-pt-upper _-pt-lower))))
_-rc))
;;;
;; (_C-u 4)
;; (_C-u 1)
(defun _C-u (arg1)
(if (and arg1
(integerp arg1)
(= 4 arg1))
t))
;; NOTE: (defun tx-editing-insert-page-break-mid-paragraph (&optional arg1)
;; NOTE: (defun tx-editing-insert-page-break-mid-paragraph (arg1)
(defun _C-u-message (arg1)
(interactive "p")
(message "%s" (prin1-to-string arg1)))
(provide '_)
;;;
;