emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r102626: * lisp/textmodes/texinfo.el


From: Stefan Monnier
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r102626: * lisp/textmodes/texinfo.el (texinfo-mode-map): Bind address@hidden
Date: Fri, 10 Dec 2010 09:10:08 -0500
User-agent: Bazaar (2.0.3)

------------------------------------------------------------
revno: 102626
committer: Stefan Monnier <address@hidden>
branch nick: trunk
timestamp: Fri 2010-12-10 09:10:08 -0500
message:
  * lisp/textmodes/texinfo.el (texinfo-mode-map): Bind address@hidden
  (texinfo-mode): Don't disable adaptive-fill-mode.
  (texinfo-insert-block): Adjust cursor placement for blocks with arg.
  (address@hidden, texinfo-insert-braces, address@hidden)
  (address@hidden, address@hidden, address@hidden)
  (address@hidden, address@hidden, address@hidden)
  (address@hidden, address@hidden, address@hidden)
  (address@hidden, address@hidden)
  (address@hidden, address@hidden, address@hidden)
  (address@hidden): Use define-skeleton.
  (address@hidden): Delete.
modified:
  lisp/ChangeLog
  lisp/textmodes/texinfo.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2010-12-10 11:56:44 +0000
+++ b/lisp/ChangeLog    2010-12-10 14:10:08 +0000
@@ -1,3 +1,17 @@
+2010-12-10  Stefan Monnier  <address@hidden>
+
+       * textmodes/texinfo.el (texinfo-mode-map): Bind address@hidden
+       (texinfo-mode): Don't disable adaptive-fill-mode.
+       (texinfo-insert-block): Adjust cursor placement for blocks with arg.
+       (address@hidden, texinfo-insert-braces, address@hidden)
+       (address@hidden, address@hidden, address@hidden)
+       (address@hidden, address@hidden, address@hidden)
+       (address@hidden, address@hidden, address@hidden)
+       (address@hidden, address@hidden)
+       (address@hidden, address@hidden, address@hidden)
+       (address@hidden): Use define-skeleton.
+       (address@hidden): Delete.
+
 2010-12-10  Eli Zaretskii  <address@hidden>
 
        * arc-mode.el (archive-zip-extract): If w32-quote-process-args is
@@ -16,8 +30,8 @@
 
        * menu-bar.el (menu-bar-frame-for-menubar, menu-bar-positive-p):
        New functions.
-       (menu-bar-showhide-menu) <menu-bar-mode, showhide-tool-bar>: Use
-       them instead of `nil' and `>', respectively.
+       (menu-bar-showhide-menu) <menu-bar-mode, showhide-tool-bar>:
+       Use them instead of `nil' and `>', respectively.
        (menu-bar-showhide-tool-bar-menu): Use menu-bar-frame-for-menubar
        instead of `nil'.
        (toggle-menu-bar-mode-from-frame): Use menu-bar-frame-for-menubar

=== modified file 'lisp/textmodes/texinfo.el'
--- a/lisp/textmodes/texinfo.el 2010-09-10 23:13:42 +0000
+++ b/lisp/textmodes/texinfo.el 2010-12-10 14:10:08 +0000
@@ -443,7 +443,9 @@
     (define-key map "\C-c\C-s"     'texinfo-show-structure)
 
     (define-key map "\C-c}"          'up-list)
+    ;; FIXME: This is often used for "close block" aka address@hidden
     (define-key map "\C-c]"          'up-list)
+    (define-key map "\C-c/"         'address@hidden)
     (define-key map "\C-c{"            'texinfo-insert-braces)
 
     ;; bindings for inserting strings
@@ -583,11 +585,8 @@
        (concat "\b\\|@[a-zA-Z]*[ \n]\\|" paragraph-separate))
   (make-local-variable 'paragraph-start)
   (setq paragraph-start (concat "\b\\|@[a-zA-Z]*[ \n]\\|" paragraph-start))
-  (make-local-variable 'sentence-end-base)
-  (setq sentence-end-base
+  (set (make-local-variable 'sentence-end-base)
        "\\(@\\(end\\)?dots{}\\|[.?!]\\)[]\"'”)}]*")
-  (make-local-variable 'adaptive-fill-mode)
-  (setq adaptive-fill-mode nil)
   (make-local-variable 'fill-column)
   (setq fill-column 70)
   (make-local-variable 'comment-start)
@@ -646,7 +645,13 @@
        (completing-read (format "Block name [%s]: " texinfo-block-default)
                         texinfo-environments
                         nil nil nil nil texinfo-block-default))
-  \n "@" str \n _ \n "@end " str \n)
+  \n "@" str
+  ;; Blocks that take parameters: all the def* blocks take parameters,
+  ;;  plus a few others.
+  (if (or (string-match "\\`def" str)
+          (member str '("table" "ftable" "vtable")))
+      '(nil " " -))
+  \n _ \n "@end " str \n)
 
 (defun texinfo-inside-macro-p (macro &optional bound)
   "Non-nil if inside a macro matching the regexp MACRO."
@@ -717,163 +722,131 @@
                (not (looking-at "@end"))))
     (texinfo-next-unmatched-end)))
 
-(defun address@hidden ()
+(define-skeleton address@hidden
   "Insert the matching address@hidden' for the last Texinfo command that needs 
one."
-  (interactive)
-  (let ((string
         (ignore-errors
           (save-excursion
+      (backward-word 1)
             (texinfo-last-unended-begin)
-            (match-string 1)))))
-    (insert "@end ")
-    (if string (insert string "\n"))))
-
-;; The following insert commands accept a prefix arg N, which is the
-;; number of words (actually s-exprs) that should be surrounded by
-;; braces.  Thus you can first paste a variable name into a .texinfo
-;; buffer, then say C-u 1 C-c C-c v at the beginning of the just
-;; pasted variable name to put @var{...} *around* the variable name.
-;; Operate on previous word or words with negative arg.
-
-;; These commands use address@hidden
-(defun address@hidden (string &optional arg)
-  (if arg
-      (progn
-        (setq arg (prefix-numeric-value arg))
-        (if (< arg 0)
-            (progn
-              (skip-chars-backward " \t\n\r\f")
-              (save-excursion
-                (forward-sexp arg)
-                (insert "@" string "{"))
-              (insert "}"))
-          (skip-chars-forward " \t\n\r\f")
-          (insert "@" string "{")
-          (forward-sexp arg)
-          (insert "}")))
-    (insert "@" string "{}")
-    (backward-char)))
-
-(defun texinfo-insert-braces ()
+      (or (match-string 1) '-)))
+  \n "@end " str \n)
+
+(define-skeleton texinfo-insert-braces
   "Make a pair of braces and be poised to type inside of them.
 Use \\[up-list] to move forward out of the braces."
-  (interactive)
-  (insert "{}")
-  (backward-char))
+  nil
+  "{" _ "}")
 
-(defun address@hidden (&optional arg)
+(define-skeleton address@hidden
   "Insert a address@hidden' command in a Texinfo buffer.
 A numeric argument says how many words the braces should surround.
 The default is not to surround any existing words with the braces."
-  (interactive "P")
-  (address@hidden "code" arg))
+  nil
+  "@code{" _ "}")
 
-(defun address@hidden (&optional arg)
+(define-skeleton address@hidden
   "Insert a address@hidden' command in a Texinfo buffer.
 A numeric argument says how many words the braces should surround.
 The default is not to surround any existing words with the braces."
-  (interactive "P")
-  (address@hidden "dfn" arg))
+  nil
+  "@dfn{" _ "}")
 
-(defun address@hidden (&optional arg)
+(define-skeleton address@hidden
   "Insert a address@hidden' command in a Texinfo buffer.
 A numeric argument says how many words the braces should surround.
 The default is not to surround any existing words with the braces."
-  (interactive "P")
-  (address@hidden "email" arg))
+  nil
+  "@email{" _ "}")
 
-(defun address@hidden (&optional arg)
+(define-skeleton address@hidden
   "Insert a address@hidden' command in a Texinfo buffer.
 A numeric argument says how many words the braces should surround.
 The default is not to surround any existing words with the braces."
-  (interactive "P")
-  (address@hidden "emph" arg))
+  nil
+  "@emph{" _ "}")
 
-(defun address@hidden ()
+(define-skeleton address@hidden
   "Insert the string address@hidden' in a Texinfo buffer."
-  (interactive)
-  (insert "@example\n"))
+  nil
+  \n "@example" \n)
 
-(defun address@hidden (&optional arg)
+(define-skeleton address@hidden
   "Insert a address@hidden' command in a Texinfo buffer.
 A numeric argument says how many words the braces should surround.
 The default is not to surround any existing words with the braces."
-  (interactive "P")
-  (address@hidden "file" arg))
+  nil
+  "@file{" _ "}")
 
-(defun address@hidden ()
+(define-skeleton address@hidden
   "Insert the string address@hidden' in a Texinfo buffer.
 If in a table defined by @table, follow said string with a space.
 Otherwise, follow with a newline."
-  (interactive)
-  (insert "@item"
+  nil
+  \n "@item"
          (if (equal (ignore-errors
                      (save-excursion
                        (texinfo-last-unended-begin)
                        (match-string 1)))
                     "table")
-             ?\s
-           ?\n)))
+      " " '\n)
+  _ \n)
 
-(defun address@hidden (&optional arg)
+(define-skeleton address@hidden
   "Insert a address@hidden' command in a Texinfo buffer.
 A numeric argument says how many words the braces should surround.
 The default is not to surround any existing words with the braces."
-  (interactive "P")
-  (address@hidden "kbd" arg))
+  nil
+  "@kbd{" _ "}")
 
-(defun address@hidden ()
+(define-skeleton address@hidden
   "Insert the string address@hidden' in a Texinfo buffer.
 Insert a comment on the following line indicating the order of
 arguments to @node.  Insert a carriage return after the comment line.
 Leave point after address@hidden'."
-  (interactive)
-  (insert "@node address@hidden  node-name,  next,  previous,  up\n")
-  (forward-line -2)
-  (forward-char 6))
+  nil
+  \n "@node " _ \n)
 
-(defun address@hidden ()
+(define-skeleton address@hidden
   "Insert the string address@hidden' in a Texinfo buffer."
-  (interactive)
-  (insert "@noindent\n"))
+  nil
+  \n "@noindent" \n)
 
-(defun address@hidden ()
+(define-skeleton address@hidden
   "Insert the string address@hidden' in a Texinfo buffer."
-  (interactive)
-  (insert "@quotation\n"))
+  \n "@quotation" \n)
 
-(defun address@hidden (&optional arg)
+(define-skeleton address@hidden
   "Insert a address@hidden' command in a Texinfo buffer.
 A numeric argument says how many words the braces should surround.
 The default is not to surround any existing words with the braces."
-  (interactive "P")
-  (address@hidden "samp" arg))
+  nil
+  "@samp{" _ "}")
 
-(defun address@hidden (&optional arg)
+(define-skeleton address@hidden
   "Insert a address@hidden' command in a Texinfo buffer.
 A numeric argument says how many words the braces should surround.
 The default is not to surround any existing words with the braces."
-  (interactive "P")
-  (address@hidden "strong" arg))
+  nil
+  "@strong{" _ "}")
 
-(defun address@hidden ()
+(define-skeleton address@hidden
   "Insert the string address@hidden' in a Texinfo buffer."
-  (interactive)
-  (insert "@table "))
+  nil
+  \n "@table " _ \n)
 
-(defun address@hidden (&optional arg)
+(define-skeleton address@hidden
   "Insert a address@hidden' command in a Texinfo buffer.
 A numeric argument says how many words the braces should surround.
 The default is not to surround any existing words with the braces."
-  (interactive "P")
-  (address@hidden "var" arg))
+  nil
+  "@var{" _ "}")
 
-(defun address@hidden (&optional arg)
+(define-skeleton address@hidden
   "Insert a address@hidden' command in a Texinfo buffer.
 A numeric argument says how many words the braces should surround.
 The default is not to surround any existing words with the braces."
-  (interactive "P")
-  (address@hidden "uref" arg))
+  nil
+  "@uref{" _ "}")
 (defalias 'address@hidden 'address@hidden)
 
 ;;; Texinfo file structure


reply via email to

[Prev in Thread] Current Thread [Next in Thread]