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

📄 texinfmt.el

📁 gcc-2.95.3 Linux下最常用的C编译器
💻 EL
📖 第 1 页 / 共 5 页
字号:
  "*An alist of next higher levels for chapters, sections. etc.For example, section to chapter, subsection to section.Used by `texinfo-raise-lower-sections'.The keys specify types of section; the values correspond to the nexthigher types.")(defvar texinfo-lowersections-alist  '((@chapter . @section)      (@unnumbered . @unnumberedsec)    (@centerchap . @unnumberedsec)    (@majorheading . @heading)    (@chapheading . @heading)    (@appendix . @appendixsec)        (@section . @subsection)    (@unnumberedsec . @unnumberedsubsec)    (@heading . @subheading)    (@appendixsec . @appendixsubsec)        (@subsection . @subsubsection)    (@unnumberedsubsec . @unnumberedsubsubsec)    (@subheading . @subsubheading)    (@appendixsubsec . @appendixsubsubsec)        (@subsubsection . @subsubsection) ; Cannot go lower.    (@unnumberedsubsubsec . @unnumberedsubsubsec)    (@subsubheading . @subsubheading)    (@appendixsubsubsec . @appendixsubsubsec))  "*An alist of next lower levels for chapters, sections. etc.For example, chapter to section, section to subsection.Used by `texinfo-raise-lower-sections'.The keys specify types of section; the values correspond to the nextlower types.");;; Perform those texinfo-to-info conversions that apply to the whole input;;; uniformly.(defun texinfo-format-scan ()  (texinfo-format-convert (point-min) (point-max))  ;; Scan for @-commands.  (goto-char (point-min))  (while (search-forward "@" nil t)    ;;    ;; These are the single-character accent commands: @^ @` @' @" @= @~    ;; In Info, they are simply quoted and the @ deleted.    ;; Other single-character commands:    ;; @* forces a line break,     ;; @- is a discretionary hyphenation point; does nothing in Info.    ;; @<space>, @<tab>, @<newline> each produce a single space,    ;;    unless followed by a newline.    ;;       ;; Old version 2.34 expression: (looking-at "[@{}^'` *\"?!]")    (if (looking-at "[@{}^'`\"=~ \t\n*?!-]")        ;; @*, causes a line break.        (cond          ;; @*, a line break         ((= (following-char) ?*)          ;; remove command          (delete-region (1- (point)) (1+ (point)))          ;; insert return if not at end of line;          ;; else line is already broken.          (if (not (= (following-char) ?\n))              (insert ?\n)))               ;; @-, deleted         ((= (following-char) ?-)          (delete-region (1- (point)) (1+ (point))))         ;; @<space>, @<tab>, @<newline>: produce a single space,         ;;    unless followed by a newline.         ((= (following-char) ? )          (delete-region (1- (point)) (1+ (point)))          ;; insert single space if not at end of line;          ;; else line is already broken.          (if (not (= (following-char) ?\n))              (insert ? )))               ((= (following-char) ?\t)          (delete-region (1- (point)) (1+ (point)))          ;; insert single space if not at end of line;          ;; else line is already broken.          (if (not (= (following-char) ?\n))              (insert ? )))         ;; following char is a carriage return         ((= (following-char) ?)          ;; remove command          (delete-region (1- (point)) (1+ (point)))          ;; insert single space if not at end of line;          ;; else line is already broken.          (if (not (= (following-char) ?\n))              (insert ? )))         ;; Otherwise: the other characters are simply quoted.  Delete the @.         (t         (delete-char -1)         (forward-char 1)))      ;; @ is followed by a command-word; find the end of the word.      (setq texinfo-command-start (1- (point)))      (if (= (char-syntax (following-char)) ?w)          (forward-word 1)        (forward-char 1))      (setq texinfo-command-end (point))      ;; Handle let aliasing      (setq texinfo-command-name	    (let (trial		  (cmdname 		   (buffer-substring		    (1+ texinfo-command-start) texinfo-command-end)))	      (while (setq trial (assoc cmdname texinfo-alias-list))		(setq cmdname (cdr trial)))            (intern cmdname)))      ;; Call the handler for this command.      (let ((enclosure-type             (assoc              (symbol-name texinfo-command-name)              texinfo-enclosure-list)))        (if enclosure-type            (progn              (insert               (car (car (cdr enclosure-type)))                (texinfo-parse-arg-discard)               (car (cdr (car (cdr enclosure-type)))))              (goto-char texinfo-command-start))          (let ((cmd (get texinfo-command-name 'texinfo-format)))            (if cmd (funcall cmd) (texinfo-unsupported)))))))    (cond (texinfo-stack         (goto-char (nth 2 (car texinfo-stack)))         (error "Unterminated @%s" (car (car texinfo-stack))))))(put 'begin 'texinfo-format 'texinfo-format-begin)(defun texinfo-format-begin ()  (texinfo-format-begin-end 'texinfo-format))(put 'end 'texinfo-format 'texinfo-format-end)(defun texinfo-format-end ()  (texinfo-format-begin-end 'texinfo-end))(defun texinfo-format-begin-end (prop)  (setq texinfo-command-name (intern (texinfo-parse-line-arg)))  (let ((cmd (get texinfo-command-name prop)))    (if cmd (funcall cmd)      (texinfo-unsupported))));;; Parsing functions(defun texinfo-parse-line-arg ()  "Return argument of @-command as string.Argument is separated from command either by a space or by a brace.  If a space, return rest of line, with beginning and ending whitespace removed.  If a brace, return string between braces.Leave point after argument."  (goto-char texinfo-command-end)  (let ((start (point)))    (cond ((looking-at " ")           (skip-chars-forward " ")           (setq start (point))           (end-of-line)           (skip-chars-backward " ")           (delete-region (point) (progn (end-of-line) (point)))           (setq texinfo-command-end (1+ (point))))          ((looking-at "{")           (setq start (1+ (point)))           (forward-list 1)           (setq texinfo-command-end (point))           (forward-char -1))          (t           (error "Invalid texinfo command arg format")))    (prog1 (buffer-substring start (point))           (if (eolp) (forward-char 1)))))(defun texinfo-parse-expanded-arg ()  (goto-char texinfo-command-end)  (let ((start (point))        marker)    (cond ((looking-at " ")           (skip-chars-forward " ")           (setq start (point))           (end-of-line)           (setq texinfo-command-end (1+ (point))))          ((looking-at "{")           (setq start (1+ (point)))           (forward-list 1)           (setq texinfo-command-end (point))           (forward-char -1))          (t           (error "Invalid texinfo command arg format")))    (setq marker (move-marker (make-marker) texinfo-command-end))    (texinfo-format-expand-region start (point))    (setq texinfo-command-end (marker-position marker))    (move-marker marker nil)    (prog1 (buffer-substring start (point))           (if (eolp) (forward-char 1)))))(defun texinfo-format-expand-region (start end)  (save-restriction    (narrow-to-region start end)    (let (texinfo-command-start          texinfo-command-end          texinfo-command-name          texinfo-stack)      (texinfo-format-scan))    (goto-char (point-max))))(defun texinfo-parse-arg-discard ()  "Delete command and argument; return argument of command."  (prog1 (texinfo-parse-line-arg)         (texinfo-discard-command)))(defun texinfo-discard-command ()  (delete-region texinfo-command-start texinfo-command-end))(defun texinfo-optional-braces-discard ()  "Discard braces following command, if any."  (goto-char texinfo-command-end)  (let ((start (point)))    (cond ((looking-at "[ \t]*\n"))     ; do nothing          ((looking-at "{")             ; remove braces, if any           (forward-list 1)           (setq texinfo-command-end (point)))          (t           (error            "Invalid `texinfo-optional-braces-discard' format \(need braces?\)")))    (delete-region texinfo-command-start texinfo-command-end)))(defun texinfo-format-parse-line-args ()  (let ((start (1- (point)))        next beg end        args)    (skip-chars-forward " ")    (while (not (eolp))      (setq beg (point))      (re-search-forward "[\n,]")      (setq next (point))      (if (bolp) (setq next (1- next)))      (forward-char -1)      (skip-chars-backward " ")      (setq end (point))      (setq args (cons (if (> end beg) (buffer-substring beg end))                       args))      (goto-char next)      (skip-chars-forward " "))    (if (eolp) (forward-char 1))    (setq texinfo-command-end (point))    (nreverse args)))(defun texinfo-format-parse-args ()  (let ((start (1- (point)))        next beg end        args)    (search-forward "{")    (save-excursion      (texinfo-format-expand-region        (point)       (save-excursion (up-list 1) (1- (point)))))    ;; The following does not handle cross references of the form:    ;; `@xref{bullet, , @code{@@bullet}@{@}}.' because the    ;; re-search-forward finds the first right brace after the second    ;; comma.     (while (/= (preceding-char) ?\})      (skip-chars-forward " \t\n")      (setq beg (point))      (re-search-forward "[},]")      (setq next (point))      (forward-char -1)      (skip-chars-backward " \t\n")      (setq end (point))      (cond ((< beg end)             (goto-char beg)             (while (search-forward "\n" end t)               (replace-match " "))))      (setq args (cons (if (> end beg) (buffer-substring beg end))                       args))      (goto-char next))    (if (eolp) (forward-char 1))    (setq texinfo-command-end (point))    (nreverse args)))(defun texinfo-format-parse-defun-args ()  (goto-char texinfo-command-end)  (let ((start (point)))    (end-of-line)    (setq texinfo-command-end (1+ (point)))    (let ((marker (move-marker (make-marker) texinfo-command-end)))      (texinfo-format-expand-region start (point))      (setq texinfo-command-end (marker-position marker))      (move-marker marker nil))    (goto-char start)    (let ((args '())          beg end)      (skip-chars-forward " ")      (while (not (eolp))        (cond ((looking-at "{")               (setq beg (1+ (point)))               (forward-list 1)               (setq end (1- (point))))              (t               (setq beg (point))               (re-search-forward "[\n ]")               (forward-char -1)               (setq end (point))))        (setq args (cons (buffer-substring beg end) args))        (skip-chars-forward " "))      (forward-char 1)      (nreverse args))))(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))))(defun texinfo-discard-line-with-args ()  (goto-char texinfo-command-start)  (delete-region (point) (progn (forward-line 1) (point))));;; @setfilename;; Only `texinfo-format-buffer' handles @setfilename with this;; definition; `texinfo-format-region' handles @setfilename, if any,;; specially. (put 'setfilename 'texinfo-format 'texinfo-format-setfilename)(defun texinfo-format-setfilename ()  (let ((arg (texinfo-parse-arg-discard)))    (message "Formatting Info file: %s" arg)    (setq texinfo-format-filename          (file-name-nondirectory (expand-file-name arg)))    (insert "Info file: "            texinfo-format-filename ",    -*-Text-*-\n"            "produced by `texinfo-format-buffer'\n"            ;; Date string removed so that regression testing is easier.            ;; "on "            ;; (insert (format-time-string "%e %b %Y")) " "            "from file"            (if (buffer-file-name input-buffer)                (concat " `"                        (file-name-sans-versions                         (file-name-nondirectory                          (buffer-file-name input-buffer)))                        "'")              (concat "buffer `" (buffer-name input-buffer) "'"))            "\nusing `texinfmt.el' version "            texinfmt-version            ".\n\n")));;; @node, @menu, @detailmenu(put 'node 'texinfo-format 'texinfo-format-node)(put 'nwnode 'texinfo-format 'texinfo-format-node)(defun texinfo-format-node ()  (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 (list tem) texinfo-node-names))))    (setq texinfo-footnote-number 0)    ;; insert "\n\^_" unconditionally since this is what info is looking for    (insert "\n\^_\nFile: " texinfo-format-filename            ", Node: " name)    (if next        (insert ", Next: " next))    (if prev        (insert ", Prev: " prev))

⌨️ 快捷键说明

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