?? texnfo-upd.el
字號(hào):
(end-of-line) (delete-region (point) (save-excursion (skip-chars-backward " \t") (point))) (indent-to texinfo-column-for-description 2) (save-excursion (insert title))));;; Handling description indentation;; Since the make-menu functions indent descriptions, these functions;; are useful primarily for indenting a single menu specially.(defun texinfo-indent-menu-description (column &optional region-p) "Indent every description in menu following point to COLUMN. Non-nil argument (prefix, if interactive) means indent everydescription in every menu in the region. Does not indent second andsubsequent lines of a multi-line description." (interactive "nIndent menu descriptions to (column number): \nP") (save-excursion (save-restriction (widen) (if (not region-p) (progn (re-search-forward "^@menu") (texinfo-menu-indent-description column) (message "Indented descriptions in menu. You may save the buffer.")) ;;else (message "Indenting every menu description in region... ") (goto-char (region-beginning)) (while (and (< (point) (region-end)) (texinfo-locate-menu-p)) (forward-line 1) (texinfo-menu-indent-description column)) (message "Indenting done. You may save the buffer.")))))(defun texinfo-menu-indent-description (to-column-number) "Indent the Texinfo file menu description to TO-COLUMN-NUMBER.Start with point just after the word `menu' in the `@menu' line andleave point on the line before the `@end menu' line. Does not indentsecond and subsequent lines of a multi-line description." (let* ((beginning-of-next-line (point))) (while (< beginning-of-next-line (save-excursion ; beginning of end menu line (goto-char (texinfo-menu-end)) (beginning-of-line) (point))) (if (re-search-forward "\\* \\(.*::\\|.*: [^.,\t\n]+[.,\t]\\)" (texinfo-menu-end) t) (progn (let ((beginning-white-space (point))) (skip-chars-forward " \t") ; skip over spaces (if (looking-at "\\(@\\|\\w\\)+") ; if there is text (progn ;; remove pre-existing indentation (delete-region beginning-white-space (point)) (indent-to-column to-column-number)))))) ;; position point at beginning of next line (forward-line 1) (setq beginning-of-next-line (point)))));;; Making the master menu(defun texinfo-master-menu (update-all-nodes-menus-p) "Make a master menu for a whole Texinfo file.Non-nil argument (prefix, if interactive) means first update allexisting nodes and menus. Remove pre-existing master menu, if there is one.This function creates a master menu that follows the top node. Themaster menu includes every entry from all the other menus. Itreplaces any existing ordinary menu that follows the top node.If called with a non-nil argument, this function first updates all themenus in the buffer (incorporating descriptions from pre-existingmenus) before it constructs the master menu.The function removes the detailed part of an already existing mastermenu. This action depends on the pre-existing master menu using thestandard `texinfo-master-menu-header'.The master menu has the following format, which is adapted from therecommendation in the Texinfo Manual: * The first part contains the major nodes in the Texinfo file: the nodes for the chapters, chapter-like sections, and the major appendices. This includes the indices, so long as they are in chapter-like sections, such as unnumbered sections. * The second and subsequent parts contain a listing of the other, lower level menus, in order. This way, an inquirer can go directly to a particular node if he or she is searching for specific information.Each of the menus in the detailed node listing is introduced by thetitle of the section containing the menu." (interactive "P") (let ((case-fold-search t)) (widen) (goto-char (point-min)) ;; Move point to location after `top'. (if (not (re-search-forward "^@node [ \t]*top[ \t]*\\(,\\|$\\)" nil t)) (error "This buffer needs a Top node!")) (let ((first-chapter (save-excursion (or (re-search-forward "^@node" nil t) (error "Too few nodes for a master menu!")) (point)))) (if (search-forward texinfo-master-menu-header first-chapter t) (progn ;; Check if @detailmenu kludge is used; ;; if so, leave point before @detailmenu. (search-backward "\n@detailmenu" (save-excursion (forward-line -3) (point)) t) ;; Remove detailed master menu listing (goto-char (match-beginning 0)) (let ((end-of-detailed-menu-descriptions (save-excursion ; beginning of end menu line (goto-char (texinfo-menu-end)) (beginning-of-line) (forward-char -1) (point)))) (delete-region (point) end-of-detailed-menu-descriptions))))) (if update-all-nodes-menus-p (progn (message "Making a master menu in %s ...first updating all nodes... " (buffer-name)) (sleep-for 2) (texinfo-update-node (point-min) (point-max)) (message "Updating all menus in %s ... " (buffer-name)) (sleep-for 2) (texinfo-make-menu (point-min) (point-max)))) (message "Now making the master menu in %s... " (buffer-name)) (sleep-for 2) (goto-char (point-min)) (texinfo-insert-master-menu-list (texinfo-master-menu-list)) ;; Remove extra newlines that texinfo-insert-master-menu-list ;; may have inserted. (save-excursion (goto-char (point-min)) (if (search-forward texinfo-master-menu-header nil t) (progn (goto-char (match-beginning 0)) ;; Check if @detailmenu kludge is used; ;; if so, leave point before @detailmenu. (search-backward "\n@detailmenu" (save-excursion (forward-line -3) (point)) t) (insert "\n") (delete-blank-lines) (goto-char (point-min)))) (re-search-forward "^@menu") (forward-line -1) (delete-blank-lines) (re-search-forward "^@end menu") (forward-line 1) (delete-blank-lines)) (message "Done...completed making master menu. You may save the buffer.")))(defun texinfo-master-menu-list () "Return a list of menu entries and header lines for the master menu.Start with the menu for chapters and indices and then find eachfollowing menu and the title of the node preceding that menu.The master menu list has this form: \(\(\(... \"entry-1-2\" \"entry-1\"\) \"title-1\"\) \(\(... \"entry-2-2\" \"entry-2-1\"\) \"title-2\"\) ...\)However, there does not need to be a title field." (let (master-menu-list) (while (texinfo-locate-menu-p) (setq master-menu-list (cons (list (texinfo-copy-menu) (texinfo-copy-menu-title)) master-menu-list))) (reverse master-menu-list)))(defun texinfo-insert-master-menu-list (master-menu-list) "Format and insert the master menu in the current buffer." (goto-char (point-min)) ;; Insert a master menu only after `Top' node and before next node ;; \(or include file if there is no next node\). (if (not (re-search-forward "^@node [ \t]*top[ \t]*\\(,\\|$\\)" nil t)) (error "This buffer needs a Top node!")) (let ((first-chapter (save-excursion (re-search-forward "^@node\\|^@include") (point)))) (if (not (re-search-forward "^@menu" first-chapter t)) (error "Buffer lacks ordinary `Top' menu in which to insert master."))) (beginning-of-line) (delete-region ; buffer must have ordinary top menu (point) (save-excursion (re-search-forward "^@end menu") (point))) (save-excursion ;; `master-menu-inserted-p' is a kludge to tell ;; whether to insert @end detailmenu (see bleow) (let (master-menu-inserted-p) ;; Handle top of menu (insert "\n@menu\n") ;; Insert chapter menu entries (setq this-very-menu-list (reverse (car (car master-menu-list)))) ;; Tell user what is going on. (message "Inserting chapter menu entry: %s ... " this-very-menu-list) (while this-very-menu-list (insert "* " (car this-very-menu-list) "\n") (setq this-very-menu-list (cdr this-very-menu-list))) (setq master-menu-list (cdr master-menu-list)) ;; Only insert detailed master menu if there is one.... (if (car (car master-menu-list)) (progn (setq master-menu-inserted-p t) (insert (concat "\n@detailmenu" texinfo-master-menu-header)))) ;; @detailmenu added 5 Sept 1996 to `texinfo-master-menu-header' ;; at Karl Berry's request to avert a bug in `makeinfo'; ;; all agree this is a bad kludge and should eventually be removed. ;; @detailmenu ... @end detailmenu is a noop in `texinfmt.el'. ;; See @end detailmenu below; ;; also see `texinfo-all-menus-update' above, `texinfo-master-menu', ;; `texinfo-multiple-files-update'. ;; Now, insert all the other menus ;; The menu master-menu-list has a form like this: ;; ((("beta" "alpha") "title-A") ;; (("delta" "gamma") "title-B")) (while master-menu-list (message "Inserting menu for %s .... " (car (cdr (car master-menu-list)))) ;; insert title of menu section (insert "\n" (car (cdr (car master-menu-list))) "\n\n") ;; insert each menu entry (setq this-very-menu-list (reverse (car (car master-menu-list)))) (while this-very-menu-list (insert "* " (car this-very-menu-list) "\n") (setq this-very-menu-list (cdr this-very-menu-list))) (setq master-menu-list (cdr master-menu-list))) ;; Finish menu ;; @detailmenu (see note above) ;; Only insert @end detailmenu if a master menu was inserted. (if master-menu-inserted-p (insert "\n@end detailmenu")) (insert "\n@end menu\n\n"))))(defun texinfo-locate-menu-p () "Find the next menu in the texinfo file.If found, leave point after word `menu' on the `@menu' line, and return t.If a menu is not found, do not move point and return nil." (re-search-forward "\\(^@menu\\)" nil t))(defun texinfo-copy-menu-title () "Return the title of the section preceding the menu as a string.If such a title cannot be found, return an empty string. Do not movepoint." (let ((case-fold-search t)) (save-excursion (if (re-search-backward (concat "\\(^@top" "\\|" ; or texinfo-section-types-regexp ; all other section types "\\)") nil t) (progn (beginning-of-line) (forward-word 1) ; skip over section type (skip-chars-forward " \t") ; and over spaces (buffer-substring (point) (progn (end-of-line) (point)))) ""))))(defun texinfo-copy-menu () "Return the entries of an existing menu as a list.Start with point just after the word `menu' in the `@menu' lineand leave point on the line before the `@end menu' line." (let* (this-menu-list (end-of-menu (texinfo-menu-end)) ; position of end of `@end menu' (last-entry (save-excursion ; position of beginning of ; last `* ' entry (goto-char end-of-menu) ;; handle multi-line description (if (not (re-search-backward "^\\* " nil t)) (error "No entries in menu.")) (point)))) (while (< (point) last-entry) (if (re-search-forward "^\\* " end-of-menu t) (progn (setq this-menu-list (cons (buffer-substring (point) ;; copy multi-line descriptions (save-excursion (re-search-forward "\\(^\\* \\|^@e\\)" nil t) (- (point) 3))) this-menu-list))))) this-menu-list))
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -