;;; Emacs-Time-stamp: "2006-12-15 23:06:51" ;;; Emacs-File-stamp: "/home/ysverdlov/leninist.biz/abbyycln.el" ;; TO-DO: History for ;; TO-DO: were distributed as a ;; TO-DO: Do not ^^1^^ ones like km2 es/1974/SR231/20060303/ ;; TO-DO: ;;; Settings: ;;; ;;; - solid line for page breaks. ;;; - ;;; (while (search-forward-regexp "[ \t]+$" nil t) (replace-match "")) ;; (unless (featurep 't2h) ;; (load-file (concat "~/"my-dns-mia"/archive/lenin/howto/tx2html.el"))) ;;(unless (featurep 'lia) ;; (error "%s: %s" "Load this file instead" ;; (concat "~/"my-dns-mia"/archive/lenin/howto/lia.el"))) (when nil (unless (featurep 'lia) (load-file "~/www.marxists.org/archive/lenin/howto/lia.el")) ) ;; SEE: f2 t runs the command t2h-insert-__title__ (when nil (while (search-forward-regexp (concat "\n
[ ]*\n" "\\(\\)?" "\\([0-9]+\\)" " " "\\(\\)?" "TO " "\\([- A-Z]+\\)" "\\(\\)?" "
[ ]*\n\n") nil t) (replace-match (concat "\n\n__SUPRATITLE__ " (match-string 2) "\n\n" "__TITLE__\n" "TO " (match-string 4) "\n\n"))) ) ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; This 1 used more frequently than others in template.htm that have same root. (fset 'my-tag-word-em [?< ?e ?m ?> C-right ?< ?/ ?e ?m ?>]) (defun my-tag-word-em-split nil "" (interactive "*") (let (t2h-side t2h-point) (when (and (looking-at "[a-zA-Z]") (save-excursion (forward-char -1) (not (looking-at "[a-zA-Z]"))) (setq t2h-dir "left")) (setq t2h-point (point)) (insert "") (goto-char t2h-point) (progn (while (and (search-backward-regexp "[a-zA-Z]") (_-sgml-markup-p))) (forward-char 1)) (insert "") (search-forward "")))) ;;; ;;; for an understanding with Ger- = ;;; ;;; many?"^^2^^ Shortly after ;;; (defun abbyycln-maybe-interactions (arg1p) "" ;; (interactive "p") (let (my-list my-cons my-re my-msnp1 my-msnp2 my-msnp3 my-msnp4 my-pt-beg my-pt-end my-n my-tag (my-tag-table (list (cons "I" "em") (cons "B" "b") (cons "SUP" "sup") (cons "SUB" "sub") )) _rc) (progn ;; Change tags. (loop for my-cons in my-tag-table do (goto-char (point-min)) (setq my-tag (car my-cons)) (while (search-forward-regexp (concat "\\(?\\)" my-tag ">") nil t) (replace-match (concat (match-string-no-properties 1) (cdr my-cons) ">"))))) (progn ;; ^M inside span markup. ;; fix! Move this to "Swaps and substitutions". (goto-char (point-min)) (while (search-forward-regexp (_-ws " \\(\\)") nil t) (replace-match (concat (match-string-no-properties 1) " ")))) (progn ;; Page numbers: just integer inside P tag. Need ^M (just above). (goto-char (point-min)) (while (search-forward-regexp (concat "\n\n" "[ \t\n]*" "\\(\\|\\)?" "\\([0-9]+\\)" "\\(\\|\\)?" "
" "[ \t]* [ \t]*" "\n\n") nil t) (setq my-pt-beg (match-beginning 0)) (replace-match (concat "\n\n" (match-string-no-properties 2) "\n\n")) (progn (goto-char my-pt-beg) (search-forward-regexp "[0-9]")))) (progn ;; Quotes (abbycln.el|html2tx.el) (goto-char (point-min)) (while (search-forward-regexp (concat "\\("\\|\"\\)" "\\([-a-zA-Z]+\\)" "\\("\\|\"\\)") nil t) (if (and (not (_-sgml-markup-p)) (not (string-match "^[-]+$" (match-string-no-properties 2)))) (replace-match (concat "``" (match-string-no-properties 2) "''"))))) (progn ;; After deleting some tags: 1st of 2 page numbers (goto-char (point-min)) (while (search-forward "\n\n" t t))) (progn ;; Superscript numbers (goto-char (point-min)) (while (search-forward-regexp (concat "\\([ \t\n]*\\)" ;; added this later. "" "\\(~^^" "\\([0-9]+\\)" "^^ ") nil t) (replace-match (concat "\n\n" (match-string-no-properties 1) "\n\n" "
\n") t t nil 0))) (progn ;; Change (delete) some tags to \n\n. (setq my-taglist (list "TD" "TR" "TABLE" "DIV" (cons "STYLE" (list (list "del.chardata"))))) (while (and my-taglist (and (setq my-tag (car my-taglist)) (or (setq my-taglist (cdr my-taglist)) t)) (goto-char (point-max))) (if (stringp my-tag) (setq my-properties nil) (setq my-properties (cdr my-tag)) (setq my-tag (car my-tag))) (while (> (point) (point-min)) (goto-char (point-min)) (while (search-forward-regexp (concat "<" my-tag "[^A-Z]") nil t) (goto-char (setq my-pt-beg (match-beginning 0))) (insert "\n\n") (delete-region (point) (search-forward ">")) (setq my-pt-beg (point)) (search-forward-regexp (concat "" my-tag ">")) (if (assoc "del.chardata" my-properties) (delete-region my-pt-beg (point)) (replace-match "")))))) ;; 2006.11.05 (while (search-forward-regexp (concat "\n\n
\n\\(\\)[*]") nil t) (replace-match "" t t nil 1)) ;; 2006.11.05 ;; Delete solo carriage returns. (progn (setq my-counter 1) (while (> my-counter 0) (setq my-counter 0) (goto-char (point-min)) (while (search-forward-regexp (concat "[\n]" "[ \t]*[\n]" "[ \t]*[\r]" "[ \t]*[\n]" "[ \t]*[\n]" ) nil t) (setq my-counter (1+ my-counter)) (replace-match "\n\n")))) ;; 2006.11.11 (while (search-forward-regexp (concat "[\r][\n][\n]" "\\(
\\)[\n]" "[0-9]+[*]" "\\(
[\r]\\)" "[\n][\n]" "\\([0-9]+\\)" ;; page # "[\n][\n][\n]" "[^\n]+
[\r][\n][\n][\n]" "[^\n]+
[\r][\n][\n]" "[0-9]+" ;; page # "[\n][\n]" ) nil t) (setq my-n (match-string-no-properties 3)) (replace-match "" t t nil 2) (replace-match (concat "__PRINTERS_P_" (int-to-string (1- (string-to-int my-n))) "_COMMENT__") t t nil 1)) )) (defun abbyycln- (&optional arg1p) "" ;; ;; TO-DO: When calculating ^M-n count '\"u' as one (1) character.* ;; TO-DO: ;; TO-DO: ;; * But, '\' will not be included in [a-zA-Z]+ (interactive "p") (let (my-re my-bfn-original my-bfn-rename my-pf-tx my _rc) (progn ;; No-nos. (goto-char (point-min)) (setq my-re " " ") ;;(if (search-forward-regexp my-re nil t) ;;(error "%s: %s" "Found" (concat "->" my-re "<-"))) ) (progn ;; Preliminaries. ;; (save-some-buffers) (setq my-bfn-original (buffer-file-name)) (when nil (if (not (string-match (concat "v37pp77" ;; "v34pp74" "[^.]*[.]htm") (setq my-pf-tx (buffer-file-name)))) (error "%s: %s" "a" "b"))) (setq my-pf-tx (progn (setq my-pf-tx (buffer-file-name)) (if (string-match "[.]html?$" my-pf-tx) (setq my-pf-tx (replace-match (concat ".tx" ;; 2006.11.05 "q" ) t t my-pf-tx))))) (if (file-exists-p my-pf-tx) (find-file my-pf-tx) (setq my-bfn-rename my-bfn-original) ;; fix? ;; Why [^mM] ? (if (not (string-match "\\([mM]\\)[^mM]*$" my-bfn-rename)) (error "%s: %s" "y" "z") (setq my-bfn-rename (replace-match "" nil nil my-bfn-rename 1))) (if (file-exists-p my-bfn-rename) (error "%s: %s" "Cannot rename: file already exists:" my-bfn-rename) (rename-file my-bfn-original my-bfn-rename) (find-file my-pf-tx) (insert-file-contents-literally my-bfn-rename) (if (setq my (get-file-buffer my-bfn-original)) (kill-buffer my))) (goto-char (point-min)) (setq my "") (if (not (search-forward my)) (error "%s: %s" "Did not find" my) (delete-region (point-min) (point))) (goto-char (point-min)) ;; Later all[ \t\n\r]\\("\\)" nil t) (replace-match "``" t t nil 1)) ) ;; 2006.08.21 ;; Was doing manually: (progn (goto-char (point-min)) (while (search-forward-regexp (concat "[^ \t\n\r]+\\(" ;; fuck! he said, 2006.09.21 ;; Most of GPSPW[12345]PP is affected. ;; ;; BEFORE: "." AFTER: "[.]" "\\)" ) nil t) (replace-match "." t t nil 1)) ) ;; 2006.09.27 - missing paragraph break inbetween footnotes. (progn (goto-char (point-min)) (while (search-forward-regexp (concat " " "\\([*]\\)" "[*]+" ;; fix? include ")" after "*"? " ") nil t) (replace-match (concat "
\n\n\n" (match-string-no-properties 1)) t t nil 1) )) _rc)) (defun abbyycln-at-point-__title__-letter (arg1p) "Execute this function with point to left of:
189 TO HIS SISTER ANNA
" ;; (interactive "p") (let (my my-cons my-msnp1 my-msnp2) (if (looking-at "[ \t\n ]") (goto-char (match-end 0))) (goto-char (car (setq my-cons (_-where-double-newlines)))) ;; ;; # and TITLE in same paragraph. (when (looking-at (concat (_-ws "\\(\\)?\\([0-9]+\\)") (_-ws "\\(
\\)? ") (concat "\\(" (_-ws " ") "\\|" (_-ws " ") "[\n][ \t]*[\n][ \t]*" "[ \t\n]+" "\\)") "\\(\\)?" "TO[ \t]+" "\\([^ ]+\\)" (_-ws " ") "[ \t]*[\n][ \t]*[\n]")) (setq my-msnp1 (match-string-no-properties 2)) (setq my-msnp2 (match-string-no-properties 6)) ;; Chop trailing tags. (save-match-data (if (string-match (_-ws "
$") my-msnp2) (setq my-msnp2 (replace-match "" nil nil my-msnp2 0))) (if (string-match (_-ws " $") my-msnp2) (setq my-msnp2 (replace-match "" nil nil my-msnp2 0)))) (replace-match (concat "__SUPRATITLE__\n" my-msnp1 "\n\n" "__TITLE__\nTO " my-msnp2 "\n\n"))))) (provide 'abbyycln)