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

📄 texinfmt.el

📁 gcc-2.95.3 Linux下最常用的C编译器
💻 EL
📖 第 1 页 / 共 5 页
字号:
      (setq texinfo-command-end (point))      (let ((filename (concat input-directory                              (texinfo-parse-line-arg))))        (re-search-backward "^@include")        (delete-region (point) (save-excursion (forward-line 1) (point)))        (message "Reading included file: %s" filename)        (save-excursion          (save-restriction            (narrow-to-region             (point)             (+ (point) (car (cdr (insert-file-contents filename)))))            (goto-char (point-min))            ;; Remove `@setfilename' line from included file, if any,            ;; so @setfilename command not duplicated.            (if (re-search-forward                  "^@setfilename"                 (save-excursion (forward-line 100) (point)) t)                (progn                  (beginning-of-line)                  (delete-region                   (point) (save-excursion (forward-line 1) (point)))))))))    ;; Raise or lower level of each section, if necessary.    (goto-char (point-min))    (texinfo-raise-lower-sections)    ;; Append @refill to appropriate paragraphs    (goto-char (point-min))    (texinfo-append-refill)    (goto-char (point-min))    (search-forward "@setfilename")    (beginning-of-line)    (delete-region (point-min) (point))    ;; Remove @bye at end of file, if it is there.    (goto-char (point-max))    (if (search-backward "@bye" nil t)        (delete-region (point) (point-max)))    ;; Make sure buffer ends in a newline.    (or (= (preceding-char) ?\n)        (insert "\n"))    ;; Scan the whole buffer, converting to Info format.    (texinfo-format-scan)    ;; Return data for indices.    (goto-char (point-min))    (list outfile          texinfo-vindex texinfo-findex texinfo-cindex          texinfo-pindex texinfo-tindex texinfo-kindex)));;; Perform non-@-command file conversions: quotes and hyphens(defun texinfo-format-convert (min max)  ;; Convert left and right quotes to typewriter font quotes.  (goto-char min)  (while (search-forward "``" max t)    (replace-match "\""))  (goto-char min)  (while (search-forward "''" max t)    (replace-match "\""))  ;; Convert three hyphens in a row to two.  (goto-char min)  (while (re-search-forward "\\( \\|\\w\\)\\(---\\)\\( \\|\\w\\)" max t)    (delete-region (1+ (match-beginning 2)) (+ 2 (match-beginning    2)))));;; Handle paragraph filling;; Keep as concatinated lists for ease of maintenance(defvar texinfo-no-refill-regexp  (concat   "^@"   "\\("   "example\\|"   "smallexample\\|"   "lisp\\|"   "smalllisp\\|"   "display\\|"   "format\\|"   "flushleft\\|"   "flushright\\|"   "menu\\|"   "multitable\\|"   "titlepage\\|"   "iftex\\|"   "ifhtml\\|"   "tex\\|"   "html"   "\\)")  "Regexp specifying environments in which paragraphs are not filled.")(defvar texinfo-accent-commands  (concat   "@^\\|"   "@`\\|"   "@'\\|"   "@\"\\|"   "@,\\|"   "@=\\|"   "@~\\|"   "@OE{\\|"   "@oe{\\|"   "@AA{\\|"   "@aa{\\|"   "@AE{\\|"   "@ae{\\|"   "@ss{\\|"   "@questiondown{\\|"   "@exclamdown{\\|"   "@L{\\|"   "@l{\\|"   "@O{\\|"   "@o{\\|"   "@dotaccent{\\|"   "@ubaraccent{\\|"   "@d{\\|"   "@H{\\|"   "@ringaccent{\\|"   "@tieaccent{\\|"   "@u{\\|"   "@v{\\|"   "@dotless{"   ))(defvar texinfo-part-of-para-regexp  (concat   "^@"   "\\("   "b{\\|"   "bullet{\\|"   "cite{\\|"   "code{\\|"   "email{\\|"   "emph{\\|"   "equiv{\\|"   "error{\\|"   "expansion{\\|"   "file{\\|"   "i{\\|"   "inforef{\\|"   "kbd{\\|"   "key{\\|"   "lisp{\\|"   "minus{\\|"   "point{\\|"   "print{\\|"   "pxref{\\|"   "r{\\|"   "ref{\\|"   "result{\\|"   "samp{\\|"   "sc{\\|"   "t{\\|"   "TeX{\\|"   "today{\\|"   "url{\\|"   "var{\\|"   "w{\\|"   "xref{\\|"   "@-\\|"    ; @- is a descretionary hyphen (not an accent) (a noop).   texinfo-accent-commands   "\\)"   )  "Regexp specifying @-commands found within paragraphs.")(defun texinfo-append-refill ()  "Append @refill at end of each paragraph that should be filled.Do not append @refill to paragraphs within @example and similar environments.  Do not append @refill to paragraphs containing @w{TEXT} or @*."  ;; It is necessary to append @refill before other processing because  ;; the other processing removes information that tells Texinfo  ;; whether the text should or should not be filled.    (while (< (point) (point-max))    (let ((refill-blank-lines "^[ \t\n]*$")          (case-fold-search nil))       ; Don't confuse @TeX and @tex....      (beginning-of-line)      ;; 1. Skip over blank lines;      ;;    skip over lines beginning with @-commands,       ;;    but do not skip over lines      ;;      that are no-refill environments such as @example or      ;;      that begin with within-paragraph @-commands such as @code.      (while (and (looking-at (concat "^@\\|^\\\\\\|" refill-blank-lines))                  (not (looking-at                         (concat                         "\\("                          texinfo-no-refill-regexp                         "\\|"                          texinfo-part-of-para-regexp                         "\\)")))                  (< (point) (point-max)))        (forward-line 1))      ;; 2. Skip over @example and similar no-refill environments.      (if (looking-at texinfo-no-refill-regexp)          (let ((environment                 (buffer-substring (match-beginning 1) (match-end 1))))            (progn (re-search-forward (concat "^@end " environment) nil t)                   (forward-line 1)))        ;; Else        ;; 3. Do not refill a paragraph containing @w or @*, or ending        ;;    with @<newline> followed by a newline.        (if  (or              (>= (point) (point-max))              (re-search-forward                "@w{\\|@\\*\\|@\n\n"                (save-excursion                 (forward-paragraph)                 (forward-line 1)                 (point)) t))            ;; Go to end of paragraph and do nothing.            (forward-paragraph)           ;; 4. Else go to end of paragraph and insert @refill          (forward-paragraph)          (forward-line -1)          (end-of-line)          (delete-region           (point)           (save-excursion (skip-chars-backward " \t") (point)))          ;; `looking-at-backward' not available in v. 18.57          ;; (if (not (looking-at-backward "@refill\\|@bye")) ;)          (if (not (re-search-backward                    "@refill\\|@bye"                    (save-excursion (beginning-of-line) (point))                    t))              (insert "@refill"))          (forward-line 1))))));;; Handle `@raisesections' and `@lowersections' commands;; These commands change the hierarchical level of chapter structuring;; commands. ;;    ;; @raisesections changes @subsection to @section,;;                        @section    to @chapter,;;                        etc.;;;; @lowersections changes @chapter    to @section;;                        @subsection to @subsubsection,;;                        etc.;;;; An @raisesections/@lowersections command changes only those;; structuring commands that follow the @raisesections/@lowersections;; command.;;;; Repeated @raisesections/@lowersections continue to raise or lower;; the heading level.;; ;; An @lowersections command cancels an @raisesections command, and;; vice versa.;;;; You cannot raise or lower "beyond" chapters or subsubsections, but;; trying to do so does not elicit an error---you just get more;; headings that mean the same thing as you keep raising or lowering;; (for example, after a single @raisesections, both @chapter and;; @section produce chapter headings).(defun texinfo-raise-lower-sections ()  "Raise or lower the hierarchical level of chapters, sections, etc. This function acts according to `@raisesections' and `@lowersections'commands in the Texinfo file.For example, an `@lowersections' command is useful if you wish toinclude what is written as an outer or standalone Texinfo file inanother Texinfo file as an inner, included file.  The `@lowersections'command changes chapters to sections, sections to subsections and soon.@raisesections changes @subsection to @section,                       @section    to @chapter,                       @heading    to @chapheading,                       etc.@lowersections changes @chapter    to @section,                       @subsection to @subsubsection,                       @heading    to @subheading,                       etc.An `@raisesections' or `@lowersections' command changes only thosestructuring commands that follow the `@raisesections' or`@lowersections' command.An `@lowersections' command cancels an `@raisesections' command, andvice versa.Repeated use of the commands continue to raise or lower the hierarchicallevel a step at a time.An attempt to raise above `chapters' reproduces chapter commands; anattempt to lower below subsubsections reproduces subsubsectioncommands."    ;; `texinfo-section-types-regexp' is defined in `texnfo-upd.el';  ;; it is a regexp matching chapter, section, other headings  ;; (but not the top node).  (let (type (level 0))    (while         (re-search-forward         (concat          "\\(\\(^@\\(raise\\|lower\\)sections\\)\\|\\("          texinfo-section-types-regexp          "\\)\\)")         nil t)      (beginning-of-line)      (save-excursion (setq type (read (current-buffer))))      (cond               ;; 1. Increment level       ((eq type '@raisesections)        (setq level (1+ level))        (delete-region         (point) (save-excursion (forward-line 1) (point))))              ;; 2. Decrement level       ((eq type '@lowersections)        (setq level (1- level))        (delete-region         (point) (save-excursion (forward-line 1) (point))))              ;; Now handle structuring commands       ((cond                  ;; 3. Raise level when positive         ((> level 0)          (let ((count level)                (new-level type))            (while (> count 0)              (setq new-level                    (cdr (assq new-level texinfo-raisesections-alist)))              (setq count (1- count)))            (kill-word 1)            (insert (symbol-name new-level))))                  ;; 4. Do nothing except move point when level is zero         ((= level 0) (forward-line 1))                  ;; 5. Lower level when positive         ((< level 0)          (let ((count level)                (new-level type))            (while (< count 0)              (setq new-level                    (cdr (assq new-level texinfo-lowersections-alist)))              (setq count (1+ count)))            (kill-word 1)            (insert (symbol-name new-level))))))))))(defvar texinfo-raisesections-alist  '((@chapter . @chapter)             ; Cannot go higher    (@unnumbered . @unnumbered)    (@centerchap . @unnumbered)    (@majorheading . @majorheading)    (@chapheading . @chapheading)    (@appendix . @appendix)        (@section . @chapter)    (@unnumberedsec . @unnumbered)    (@heading . @chapheading)    (@appendixsec . @appendix)        (@subsection . @section)    (@unnumberedsubsec . @unnumberedsec)    (@subheading . @heading)    (@appendixsubsec . @appendixsec)        (@subsubsection . @subsection)    (@unnumberedsubsubsec . @unnumberedsubsec)    (@subsubheading . @subheading)    (@appendixsubsubsec . @appendixsubsec))

⌨️ 快捷键说明

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