⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 texinfmt.el

📁 早期freebsd实现
💻 EL
📖 第 1 页 / 共 3 页
字号:
  (let* ((args (texinfo-format-parse-line-args))	 (name (nth 0 args))	 (next (nth 1 args))	 (prev (nth 2 args))	 (up (nth 3 args)))    (texinfo-discard-command)    (setq texinfo-last-node name)    (let ((tem (downcase name)))      (if (assoc tem texinfo-node-names)	  (error "Duplicate node name: %s" name)	(setq texinfo-node-names (cons tem texinfo-node-names))))    (or (bolp)	(insert ?\n))    (insert "\^_\nFile: " texinfo-format-filename	    "  Node: " name)    (if prev	(insert ", Prev: " prev))    (if up	(insert ", Up: " up))    (if next	(insert ", Next: " next))    (insert ?\n)))(put 'menu 'texinfo-format 'texinfo-format-menu)(defun texinfo-format-menu ()  (texinfo-discard-line)  (insert "* Menu:\n\n"))(put 'menu 'texinfo-end 'texinfo-discard-command)(defun texinfo-discard-line ()  (goto-char texinfo-command-end)  (skip-chars-forward " \t")  (or (eolp)      (error "Extraneous text at end of command line."))  (goto-char texinfo-command-start)  (or (bolp)      (error "Extraneous text at beginning of command line."))  (delete-region (point) (progn (forward-line 1) (point)))); @xref {NODE, FNAME, NAME, FILE, DOCUMENT}; -> *Note FNAME: (FILE)NODE;   If FILE is missing,;    *Note FNAME: NODE;   If FNAME is empty and NAME is present;    *Note NAME: Node;   If both NAME and FNAME are missing;    *Note NODE::;   texinfo ignores the DOCUMENT argument.; -> See section <xref to NODE> [NAME, else NODE], page <xref to NODE>;   If FILE is specified, (FILE)NODE is used for xrefs.;   If fifth argument DOCUMENT is specified, produces;    See section <xref to NODE> [NAME, else NODE], page <xref to NODE>;    of DOCUMENT(put 'xref 'texinfo-format 'texinfo-format-xref)(defun texinfo-format-xref ()  (let ((args (texinfo-format-parse-args)))    (texinfo-discard-command)    (insert "*Note ")    (let ((fname (or (nth 1 args) (nth 2 args))))      (if (null (or fname (nth 3 args)))	  (insert (car args) "::")	(insert (or fname (car args)) ": ")	(if (nth 3 args)	    (insert "(" (nth 3 args) ")"))	(insert (car args))))))(put 'pxref 'texinfo-format 'texinfo-format-pxref)(defun texinfo-format-pxref ()  (texinfo-format-xref)  (or (save-excursion	(forward-char -2)	(looking-at "::"))      (insert ".")));@inforef{NODE, FNAME, FILE};Like @xref{NODE, FNAME,,FILE} in texinfo.;In Tex, generates "See Info file FILE, node NODE"(put 'inforef 'texinfo-format 'texinfo-format-inforef)(defun texinfo-format-inforef ()  (let ((args (texinfo-format-parse-args)))    (texinfo-discard-command)    (insert "*Note " (nth 1 args) ": (" (nth 2 args) ")" (car args))))(put 'chapheading 'texinfo-format 'texinfo-format-chapter)(put 'ichapter 'texinfo-format 'texinfo-format-chapter)(put 'chapter 'texinfo-format 'texinfo-format-chapter)(put 'iappendix 'texinfo-format 'texinfo-format-chapter)(put 'appendix 'texinfo-format 'texinfo-format-chapter)(put 'iunnumbered 'texinfo-format 'texinfo-format-chapter)(put 'unnumbered 'texinfo-format 'texinfo-format-chapter)(defun texinfo-format-chapter ()  (texinfo-format-chapter-1 ?*))(put 'heading 'texinfo-format 'texinfo-format-section)(put 'isection 'texinfo-format 'texinfo-format-section)(put 'section 'texinfo-format 'texinfo-format-section)(put 'iappendixsection 'texinfo-format 'texinfo-format-section)(put 'appendixsection 'texinfo-format 'texinfo-format-section)(put 'iappendixsec 'texinfo-format 'texinfo-format-section)(put 'appendixsec 'texinfo-format 'texinfo-format-section)(put 'iunnumberedsec 'texinfo-format 'texinfo-format-section)(put 'unnumberedsec 'texinfo-format 'texinfo-format-section)(defun texinfo-format-section ()  (texinfo-format-chapter-1 ?=))(put 'subheading 'texinfo-format 'texinfo-format-subsection)(put 'isubsection 'texinfo-format 'texinfo-format-subsection)(put 'subsection 'texinfo-format 'texinfo-format-subsection)(put 'iappendixsubsec 'texinfo-format 'texinfo-format-subsection)(put 'appendixsubsec 'texinfo-format 'texinfo-format-subsection)(put 'iunnumberedsubsec 'texinfo-format 'texinfo-format-subsection)(put 'unnumberedsubsec 'texinfo-format 'texinfo-format-subsection)(defun texinfo-format-subsection ()  (texinfo-format-chapter-1 ?-))(put 'subsubheading 'texinfo-format 'texinfo-format-subsubsection)(put 'isubsubsection 'texinfo-format 'texinfo-format-subsubsection)(put 'subsubsection 'texinfo-format 'texinfo-format-subsubsection)(put 'iappendixsubsubsec 'texinfo-format 'texinfo-format-subsubsection)(put 'appendixsubsubsec 'texinfo-format 'texinfo-format-subsubsection)(put 'iunnumberedsubsubsec 'texinfo-format 'texinfo-format-subsubsection)(put 'unnumberedsubsubsec 'texinfo-format 'texinfo-format-subsubsection)(defun texinfo-format-subsubsection ()  (texinfo-format-chapter-1 ?.))(defun texinfo-format-chapter-1 (belowchar)  (let ((arg (texinfo-parse-arg-discard)))    (insert ?\n arg ?\n "@SectionPAD " belowchar ?\n)    (forward-line -2)))(put 'SectionPAD 'texinfo-format 'texinfo-format-sectionpad)(defun texinfo-format-sectionpad ()  (let ((str (texinfo-parse-arg-discard)))    (forward-char -1)    (let ((column (current-column)))      (forward-char 1)      (while (> column 0)	(insert str)	(setq column (1- column))))    (insert ?\n)))(put '\. 'texinfo-format 'texinfo-format-\.)(defun texinfo-format-\. ()  (texinfo-discard-command)  (insert "."))(put '\: 'texinfo-format 'texinfo-format-\:)(defun texinfo-format-\: ()  (texinfo-discard-command))(put 'center 'texinfo-format 'texinfo-format-center)(defun texinfo-format-center ()  (texinfo-discard-command)  (let ((indent-tabs-mode nil))    (center-line)));; @itemize pushes (itemize "COMMANDS" STARTPOS) on texinfo-stack.;; @enumerate pushes (enumerate 0 STARTPOS).;; @item dispatches to the texinfo-item prop of the first elt of the list.;; For itemize, this puts in and rescans the COMMANDS.;; For enumerate, this increments the number and puts it in.;; In either case, it puts a Backspace at the front of the line;; which marks it not to be indented later.;; All other lines get indented by 5 when the @end is reached.(defun texinfo-push-stack (check arg)  (setq texinfo-stack	(cons (list check arg texinfo-command-start)	      texinfo-stack)))(defun texinfo-pop-stack (check)  (if (null texinfo-stack)      (error "Unmatched @end %s" check))  (if (not (eq (car (car texinfo-stack)) check))      (error "@end %s matches @%s"	     check (car (car texinfo-stack))))  (prog1 (cdr (car texinfo-stack))	 (setq texinfo-stack (cdr texinfo-stack))))(put 'itemize 'texinfo-format 'texinfo-itemize)(defun texinfo-itemize ()  (texinfo-push-stack 'itemize (texinfo-parse-arg-discard))  (setq fill-column (- fill-column 5)))(put 'itemize 'texinfo-end 'texinfo-end-itemize)(defun texinfo-end-itemize ()  (setq fill-column (+ fill-column 5))  (texinfo-discard-command)  (let ((stacktop	 (texinfo-pop-stack 'itemize)))    (texinfo-do-itemize (nth 1 stacktop))))(put 'enumerate 'texinfo-format 'texinfo-enumerate)(defun texinfo-enumerate ()  (texinfo-push-stack 'enumerate 0)  (setq fill-column (- fill-column 5))  (texinfo-discard-line))(put 'enumerate 'texinfo-end 'texinfo-end-enumerate)(defun texinfo-end-enumerate ()  (setq fill-column (+ fill-column 5))  (texinfo-discard-command)  (let ((stacktop	 (texinfo-pop-stack 'enumerate)))    (texinfo-do-itemize (nth 1 stacktop))))(put 'table 'texinfo-format 'texinfo-table)(defun texinfo-table ()  (texinfo-push-stack 'table (texinfo-parse-arg-discard))  (setq fill-column (- fill-column 5)))(put 'ftable 'texinfo-format 'texinfo-ftable)(defun texinfo-ftable ()  (texinfo-push-stack 'table "@code")  (setq fill-column (- fill-column 5))  (texinfo-discard-line))(put 'description 'texinfo-format 'texinfo-description)(defun texinfo-description ()  (texinfo-push-stack 'table "@asis")  (setq fill-column (- fill-column 5))  (texinfo-discard-line))(put 'table 'texinfo-end 'texinfo-end-table)(put 'ftable 'texinfo-end 'texinfo-end-table)(put 'description 'texinfo-end 'texinfo-end-table)(defun texinfo-end-table ()  (setq fill-column (+ fill-column 5))  (texinfo-discard-command)  (let ((stacktop	 (texinfo-pop-stack 'table)))    (texinfo-do-itemize (nth 1 stacktop))));; At the @end, indent all the lines within the construct;; except those marked with backspace.  FROM says where;; construct started.(defun texinfo-do-itemize (from)  (save-excursion   (while (progn (forward-line -1)		 (>= (point) from))     (if (= (following-char) ?\b)	 (save-excursion	   (delete-char 1)	   (end-of-line)	   (delete-char 6))       (if (not (looking-at "[ \t]*$"))	   (save-excursion (insert "     ")))))))(put 'item 'texinfo-format 'texinfo-item)(put 'itemx 'texinfo-format 'texinfo-item)(defun texinfo-item ()  (funcall (get (car (car texinfo-stack)) 'texinfo-item)))(put 'itemize 'texinfo-item 'texinfo-itemize-item)(defun texinfo-itemize-item ()  (texinfo-discard-line)  (insert "\b   " (nth 1 (car texinfo-stack)) " \n")  (forward-line -1))(put 'enumerate 'texinfo-item 'texinfo-enumerate-item)(defun texinfo-enumerate-item ()  (texinfo-discard-line)  (let ((next (1+ (car (cdr (car texinfo-stack))))))    (setcar (cdr (car texinfo-stack)) next)    (insert ?\b (format "%3d. " next) ?\n))  (forward-line -1))(put 'table 'texinfo-item 'texinfo-table-item)(defun texinfo-table-item ()  (let ((arg (texinfo-parse-arg-discard))	(itemfont (car (cdr (car texinfo-stack)))))    (insert ?\b itemfont ?\{ arg "}\n     \n"))  (forward-line -2))(put 'ifinfo 'texinfo-format 'texinfo-discard-line)(put 'ifinfo 'texinfo-end 'texinfo-discard-command)(put 'iftex 'texinfo-format 'texinfo-format-iftex)(defun texinfo-format-iftex ()  (delete-region texinfo-command-start		 (progn (re-search-forward "@end iftex\n")			(point))))(put 'tex 'texinfo-format 'texinfo-format-tex)(defun texinfo-format-tex ()  (delete-region texinfo-command-start		 (progn (re-search-forward "@end tex\n")			(point))))(put 'titlepage 'texinfo-format 'texinfo-format-titlepage)(defun texinfo-format-titlepage ()  (delete-region texinfo-command-start		 (progn (search-forward "@end titlepage\n")			(point))))(put 'endtitlepage 'texinfo-format 'texinfo-discard-line)(put 'ignore 'texinfo-format 'texinfo-format-ignore)(defun texinfo-format-ignore ()  (delete-region texinfo-command-start		 (progn (search-forward "@end ignore\n")			(point))))(put 'endignore 'texinfo-format 'texinfo-discard-line)(put 'var 'texinfo-format 'texinfo-format-var)(defun texinfo-format-var ()  (insert (upcase (texinfo-parse-arg-discard)))  (goto-char texinfo-command-start))(put 'asis 'texinfo-format 'texinfo-format-noop)(put 'b 'texinfo-format 'texinfo-format-noop)(put 't 'texinfo-format 'texinfo-format-noop)(put 'i 'texinfo-format 'texinfo-format-noop)(put 'r 'texinfo-format 'texinfo-format-noop)(put 'key 'texinfo-format 'texinfo-format-noop)(put 'w 'texinfo-format 'texinfo-format-noop)(defun texinfo-format-noop ()  (insert (texinfo-parse-arg-discard))  (goto-char texinfo-command-start))(put 'code 'texinfo-format 'texinfo-format-code)(put 'samp 'texinfo-format 'texinfo-format-code)(put 'file 'texinfo-format 'texinfo-format-code)(put 'kbd 'texinfo-format 'texinfo-format-code)(put 'cite 'texinfo-format 'texinfo-format-code)(defun texinfo-format-code ()  (insert "`" (texinfo-parse-arg-discard) "'")  (goto-char texinfo-command-start))(put 'emph 'texinfo-format 'texinfo-format-emph)(put 'strong 'texinfo-format 'texinfo-format-emph)(defun texinfo-format-emph ()  (insert "*" (texinfo-parse-arg-discard) "*")  (goto-char texinfo-command-start))(put 'defn 'texinfo-format 'texinfo-format-defn)(put 'dfn 'texinfo-format 'texinfo-format-defn)(defun texinfo-format-defn ()  (insert "\"" (texinfo-parse-arg-discard) "\"")  (goto-char texinfo-command-start))(put 'bullet 'texinfo-format 'texinfo-format-bullet)(defun texinfo-format-bullet ()  (texinfo-discard-command)  (insert "*"))(put 'smallexample 'texinfo-format 'texinfo-format-example)(put 'example 'texinfo-format 'texinfo-format-example)(put 'quotation 'texinfo-format 'texinfo-format-example)(put 'lisp 'texinfo-format 'texinfo-format-example)(put 'display 'texinfo-format 'texinfo-format-example)(put 'format 'texinfo-format 'texinfo-format-example)(put 'flushleft 'texinfo-format 'texinfo-format-example)(defun texinfo-format-example ()  (texinfo-push-stack 'example nil)  (setq fill-column (- fill-column 5))  (texinfo-discard-line))(put 'smallexample 'texinfo-end 'texinfo-end-example)(put 'example 'texinfo-end 'texinfo-end-example)(put 'quotation 'texinfo-end 'texinfo-end-example)(put 'lisp 'texinfo-end 'texinfo-end-example)(put 'display 'texinfo-end 'texinfo-end-example)(put 'format 'texinfo-end 'texinfo-end-example)(put 'flushleft 'texinfo-end 'texinfo-end-example)(defun texinfo-end-example ()  (setq fill-column (+ fill-column 5))  (texinfo-discard-command)  (let ((stacktop	 (texinfo-pop-stack 'example)))    (texinfo-do-itemize (nth 1 stacktop))))(put 'exdent 'texinfo-format 'texinfo-format-exdent)(defun texinfo-format-exdent ()  (texinfo-discard-command)  (delete-region (point)		 (progn		  (skip-chars-forward " ")		  (point)))  (insert ?\b)  ;; Cancel out the deletion that texinfo-do-itemize  ;; is going to do at the end of this line.  (save-excursion    (end-of-line)    (insert "\n     ")))(put 'ctrl 'texinfo-format 'texinfo-format-ctrl)(defun texinfo-format-ctrl ()  (let ((str (texinfo-parse-arg-discard)))    (insert (logand 31 (aref str 0)))))(put 'TeX 'texinfo-format 'texinfo-format-TeX)(defun texinfo-format-TeX ()  (texinfo-parse-arg-discard)  (insert "TeX"))(put 'copyright 'texinfo-format 'texinfo-format-copyright)(defun texinfo-format-copyright ()  (texinfo-parse-arg-discard)  (insert "(C)"))(put 'minus 'texinfo-format 'texinfo-format-minus)(defun texinfo-format-minus ()

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -