summaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
Diffstat (limited to 'lisp')
-rw-r--r--lisp/ChangeLog55
-rw-r--r--lisp/edmacro.el56
-rw-r--r--lisp/gnus/ChangeLog10
-rw-r--r--lisp/gnus/gnus-sum.el3
-rw-r--r--lisp/gnus/mailcap.el14
-rw-r--r--lisp/indent.el26
-rw-r--r--lisp/kmacro.el35
-rw-r--r--lisp/newcomment.el4
-rw-r--r--lisp/progmodes/cc-langs.el3
-rw-r--r--lisp/term.el83
-rw-r--r--lisp/textmodes/tex-mode.el74
11 files changed, 284 insertions, 79 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 0ed8630d850..29abaaf21b8 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,7 +1,58 @@
+2004-10-03 Stefan <monnier@iro.umontreal.ca>
+
+ * textmodes/tex-mode.el (tex-dvi-view-command): Use `yap' on w32.
+ (tex-font-lock-keywords-1): Add url and nolinkurl for args with `_'.
+ (latex-block-args-alist): Add minipage and picture.
+ (latex-block-body-alist): Use reftex-label if enabled.
+ (latex-insert-block): Don't insert a \n if not necessary.
+ (tex-compile-commands): Make sure dvips doesn't send to printer.
+ (tex-compile-default): Handle the case where no executable is found.
+ (latex-noindent-environments): New var.
+ (latex-find-indent): Use it. Take an empty line as an arg-breaker.
+ If tex-indent-allhanging is non-nil, make sure we only align for macros
+ at beginning of line.
+
+2004-10-03 Daniel Pfeiffer <occitan@esperanto.org>
+
+ * newcomment.el (comment-beginning): Doc fix and don't choke on
+ unset `comment-end-skip' when at beginning of comment.
+
+2004-10-02 Dan Nicolaescu <dann@ics.uci.edu>
+
+ * term.el (term-adjust-current-row-cache): Don't allow the current
+ row to become negative.
+ (term-emulate-terminal): Fix insert mode. Handle tab insertion at
+ the end of the line. Fix scroll down. Add comments.
+ (term-handle-ansi-escape): Don't exceed terminal width when moving
+ right.
+ (term-scroll-region): Move the cursor after setting the scroll region.
+
+2004-10-01 Luc Teirlinck <teirllm@auburn.edu>
+
+ * indent.el (set-left-margin, set-right-margin): Rename `lm' arg
+ to `width' for consistency with docstring. Doc fix.
+
+2004-10-01 Martin Stjernholm <bug-cc-mode@gnu.org>
+
+ * progmodes/cc-langs.el: Load cl here since cc-defs doesn't do it.
+ This is necessary for derived modes.
+
+2004-09-30 Kim F. Storm <storm@cua.dk>
+
+ * kmacro.el (kmacro-lambda-form, kmacro-extract-lambda): Add.
+ (kmacro-bind-to-key, kmacro-name-last-macro): Use kmacro-lambda-form.
+
+ * edmacro.el: Require kmacro to use the new kmacro-lambda-form and
+ kmacro-extract-lambda functions.
+ (edit-kbd-macro): Handle kmacro lambda forms.
+ Include counter and counter format in edit buffer.
+ (edmacro-finish-edit): Get counter and format from edit buffer and
+ update kmacro bindings when found.
+
2004-09-29 Luc Teirlinck <teirllm@auburn.edu>
- * textmodes/paragraphs.el (forward-paragraph): Avoid
- args-out-of-range error when point winds up at the beginning of
+ * textmodes/paragraphs.el (forward-paragraph):
+ Avoid args-out-of-range error when point winds up at the beginning of
the buffer and hard newlines are enabled.
* newcomment.el (comment-multi-line): Doc fix.
diff --git a/lisp/edmacro.el b/lisp/edmacro.el
index 072b52fc8fd..b40cbaafe2d 100644
--- a/lisp/edmacro.el
+++ b/lisp/edmacro.el
@@ -73,6 +73,8 @@
(eval-when-compile
(require 'cl))
+(require 'kmacro)
+
;;; The user-level commands for editing macros.
;;;###autoload
@@ -101,7 +103,8 @@ With a prefix argument, format the macro in a more concise way."
(interactive "kKeyboard macro to edit (C-x e, M-x, C-h l, or keys): \nP")
(when keys
(let ((cmd (if (arrayp keys) (key-binding keys) keys))
- (mac nil))
+ (mac nil) (mac-counter nil) (mac-format nil)
+ kmacro)
(cond (store-hook
(setq mac keys)
(setq cmd nil))
@@ -112,14 +115,17 @@ With a prefix argument, format the macro in a more concise way."
(y-or-n-p "No keyboard macro defined. Create one? ")
(keyboard-quit))
(setq mac (or last-kbd-macro ""))
+ (setq keys nil)
(setq cmd 'last-kbd-macro))
((eq cmd 'execute-extended-command)
(setq cmd (read-command "Name of keyboard macro to edit: "))
(if (string-equal cmd "")
(error "No command name given"))
+ (setq keys nil)
(setq mac (symbol-function cmd)))
((memq cmd '(view-lossage electric-view-lossage))
(setq mac (recent-keys))
+ (setq keys nil)
(setq cmd 'last-kbd-macro))
((null cmd)
(error "Key sequence %s is not defined" (key-description keys)))
@@ -128,6 +134,10 @@ With a prefix argument, format the macro in a more concise way."
(t
(setq mac cmd)
(setq cmd nil)))
+ (when (setq kmacro (kmacro-extract-lambda mac))
+ (setq mac (car kmacro)
+ mac-counter (nth 1 kmacro)
+ mac-format (nth 2 kmacro)))
(unless (arrayp mac)
(error "Key sequence %s is not a keyboard macro"
(key-description keys)))
@@ -153,11 +163,15 @@ With a prefix argument, format the macro in a more concise way."
(insert ";; Original keys: " fmt "\n")
(unless store-hook
(insert "\nCommand: " (if cmd (symbol-name cmd) "none") "\n")
- (let ((keys (where-is-internal (or cmd mac) '(keymap))))
- (if keys
- (while keys
- (insert "Key: " (edmacro-format-keys (pop keys) 1) "\n"))
- (insert "Key: none\n"))))
+ (let ((gkeys (where-is-internal (or cmd mac) '(keymap))))
+ (if (and keys (not (member keys gkeys)))
+ (setq gkeys (cons keys gkeys)))
+ (if gkeys
+ (while gkeys
+ (insert "Key: " (edmacro-format-keys (pop gkeys) 1) "\n"))
+ (insert "Key: none\n")))
+ (when (and mac-counter mac-format)
+ (insert (format "Counter: %d\nFormat: \"%s\"\n" mac-counter mac-format))))
(insert "\nMacro:\n\n")
(save-excursion
(insert fmtv "\n"))
@@ -217,6 +231,7 @@ or nil, use a compact 80-column format."
"This command is valid only in buffers created by `edit-kbd-macro'"))
(run-hooks 'edmacro-finish-hook)
(let ((cmd nil) (keys nil) (no-keys nil)
+ (mac-counter nil) (mac-format nil) (kmacro nil)
(top (point-min)))
(goto-char top)
(let ((case-fold-search nil))
@@ -231,6 +246,7 @@ or nil, use a compact 80-column format."
(setq cmd (and (not (equal str "none"))
(intern str)))
(and (fboundp cmd) (not (arrayp (symbol-function cmd)))
+ (not (setq kmacro (get cmd 'kmacro)))
(not (y-or-n-p
(format "Command %s is already defined; %s"
cmd "proceed? ")))
@@ -248,6 +264,7 @@ or nil, use a compact 80-column format."
(push key keys)
(let ((b (key-binding key)))
(and b (commandp b) (not (arrayp b))
+ (not (kmacro-extract-lambda b))
(or (not (fboundp b))
(not (arrayp (symbol-function b))))
(not (y-or-n-p
@@ -256,6 +273,22 @@ or nil, use a compact 80-column format."
"proceed? ")))
(keyboard-quit))))))
t)
+ ((looking-at "Counter:[ \t]*\\([^ \t\n]*\\)[ \t]*$")
+ (when edmacro-store-hook
+ (error "\"Counter\" line not allowed in this context"))
+ (let ((str (buffer-substring (match-beginning 1)
+ (match-end 1))))
+ (unless (equal str "")
+ (setq mac-counter (string-to-int str))))
+ t)
+ ((looking-at "Format:[ \t]*\"\\([^\n]*\\)\"[ \t]*$")
+ (when edmacro-store-hook
+ (error "\"Format\" line not allowed in this context"))
+ (let ((str (buffer-substring (match-beginning 1)
+ (match-end 1))))
+ (unless (equal str "")
+ (setq mac-format str)))
+ t)
((looking-at "Macro:[ \t\n]*")
(goto-char (match-end 0))
nil)
@@ -285,7 +318,10 @@ or nil, use a compact 80-column format."
(when cmd
(if (= (length mac) 0)
(fmakunbound cmd)
- (fset cmd mac)))
+ (fset cmd
+ (if (and mac-counter mac-format)
+ (kmacro-lambda-form mac mac-counter mac-format)
+ mac))))
(if no-keys
(when cmd
(loop for key in (where-is-internal cmd '(keymap)) do
@@ -294,7 +330,11 @@ or nil, use a compact 80-column format."
(if (= (length mac) 0)
(loop for key in keys do (global-unset-key key))
(loop for key in keys do
- (global-set-key key (or cmd mac)))))))))
+ (global-set-key key
+ (or cmd
+ (if (and mac-counter mac-format)
+ (kmacro-lambda-form mac mac-counter mac-format)
+ mac))))))))))
(kill-buffer buf)
(when (buffer-name obuf)
(switch-to-buffer obuf))
diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog
index 6ac6d46e28f..907ad5f3411 100644
--- a/lisp/gnus/ChangeLog
+++ b/lisp/gnus/ChangeLog
@@ -1,3 +1,13 @@
+2004-10-01 Katsumi Yamaoka <yamaoka@jpl.org>
+
+ * gnus-sum.el (gnus-summary-toggle-header): Make it work even if
+ there's no visible header.
+
+2004-10-01 Simon Josefsson <jas@extundo.com>
+
+ * mailcap.el (mailcap-mime-data): Add pdf. Remove non-free
+ acroread.
+
2004-09-29 Jesper Harder <harder@ifa.au.dk>
* gnus.el (gnus-method-to-server): Oops, move it don't delete it.
diff --git a/lisp/gnus/gnus-sum.el b/lisp/gnus/gnus-sum.el
index 7ecc7eb19b9..40278da4716 100644
--- a/lisp/gnus/gnus-sum.el
+++ b/lisp/gnus/gnus-sum.el
@@ -8732,7 +8732,8 @@ If ARG is a negative number, hide the unwanted header lines."
(inhibit-point-motion-hooks t)
(hidden (if (numberp arg)
(>= arg 0)
- (gnus-article-hidden-text-p 'headers)))
+ (or (not (looking-at "[^ \t\n]+:"))
+ (gnus-article-hidden-text-p 'headers))))
s e)
(delete-region (point-min) (point-max))
(with-current-buffer gnus-original-article-buffer
diff --git a/lisp/gnus/mailcap.el b/lisp/gnus/mailcap.el
index db0ab6143e1..d285e342370 100644
--- a/lisp/gnus/mailcap.el
+++ b/lisp/gnus/mailcap.el
@@ -1,5 +1,5 @@
;;; mailcap.el --- MIME media types configuration
-;; Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003
+;; Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004
;; Free Software Foundation, Inc.
;; Author: William M. Perry <wmperry@aventail.com>
@@ -135,23 +135,21 @@
(non-viewer . t)
(type . "application/zip")
("copiousoutput"))
- ;; Prefer free viewers.
("pdf"
(viewer . "gv -safer %s")
(type . "application/pdf")
(test . window-system)
("print" . ,(concat "pdf2ps %s - | " mailcap-print-command)))
("pdf"
- (viewer . "xpdf %s")
+ (viewer . "gpdf %s")
(type . "application/pdf")
("print" . ,(concat "pdftops %s - | " mailcap-print-command))
(test . (eq window-system 'x)))
("pdf"
- (viewer . "acroread %s")
- (type . "application/pdf")
- ("print" . ,(concat "cat %s | acroread -toPostScript | "
- mailcap-print-command))
- (test . window-system))
+ (viewer . "xpdf %s")
+ (type . "application/pdf")
+ ("print" . ,(concat "pdftops %s - | " mailcap-print-command))
+ (test . (eq window-system 'x)))
("pdf"
(viewer . ,(concat "pdftotext %s -"))
(type . "application/pdf")
diff --git a/lisp/indent.el b/lisp/indent.el
index 3f423adbace..e1a9cae4819 100644
--- a/lisp/indent.el
+++ b/lisp/indent.el
@@ -1,6 +1,6 @@
;;; indent.el --- indentation commands for Emacs
-;; Copyright (C) 1985, 1995, 2001 Free Software Foundation, Inc.
+;; Copyright (C) 1985, 1995, 2001, 2004 Free Software Foundation, Inc.
;; Maintainer: FSF
@@ -198,11 +198,14 @@ Args FROM and TO are optional; default is the whole buffer."
(forward-line 1))
(move-marker to nil)))
-(defun set-left-margin (from to lm)
+(defun set-left-margin (from to width)
"Set the left margin of the region to WIDTH.
-If `auto-fill-mode' is active, re-fill the region to fit the new margin."
+If `auto-fill-mode' is active, re-fill the region to fit the new margin.
+
+Interactively, WIDTH is the prefix argument, if specified.
+Without prefix argument, the command prompts for WIDTH."
(interactive "r\nNSet left margin to column: ")
- (if (interactive-p) (setq lm (prefix-numeric-value lm)))
+ (if (interactive-p) (setq width (prefix-numeric-value width)))
(save-excursion
;; If inside indentation, start from BOL.
(goto-char from)
@@ -214,21 +217,24 @@ If `auto-fill-mode' is active, re-fill the region to fit the new margin."
(setq to (point-marker)))
;; Delete margin indentation first, but keep paragraph indentation.
(delete-to-left-margin from to)
- (put-text-property from to 'left-margin lm)
- (indent-rigidly from to lm)
+ (put-text-property from to 'left-margin width)
+ (indent-rigidly from to width)
(if auto-fill-function (save-excursion (fill-region from to nil t t)))
(move-marker to nil))
-(defun set-right-margin (from to lm)
+(defun set-right-margin (from to width)
"Set the right margin of the region to WIDTH.
-If `auto-fill-mode' is active, re-fill the region to fit the new margin."
+If `auto-fill-mode' is active, re-fill the region to fit the new margin.
+
+Interactively, WIDTH is the prefix argument, if specified.
+Without prefix argument, the command prompts for WIDTH."
(interactive "r\nNSet right margin to width: ")
- (if (interactive-p) (setq lm (prefix-numeric-value lm)))
+ (if (interactive-p) (setq width (prefix-numeric-value width)))
(save-excursion
(goto-char from)
(skip-chars-backward " \t")
(if (bolp) (setq from (point))))
- (put-text-property from to 'right-margin lm)
+ (put-text-property from to 'right-margin width)
(if auto-fill-function (save-excursion (fill-region from to nil t t))))
(defun alter-text-property (from to prop func &optional object)
diff --git a/lisp/kmacro.el b/lisp/kmacro.el
index 5aefe46625d..b2226d4a895 100644
--- a/lisp/kmacro.el
+++ b/lisp/kmacro.el
@@ -740,6 +740,30 @@ If kbd macro currently being defined end it before activating it."
;; letters and digits, provided that we inhibit the keymap while
;; executing the macro later on (but that's controversial...)
+(defun kmacro-lambda-form (mac &optional counter format)
+ "Create lambda form for macro bound to symbol or key."
+ (if counter
+ (setq mac (list mac counter format)))
+ `(lambda (&optional arg)
+ "Keyboard macro."
+ (interactive "p")
+ (kmacro-exec-ring-item ',mac arg)))
+
+(defun kmacro-extract-lambda (mac)
+ "Extract kmacro from a kmacro lambda form."
+ (and (consp mac)
+ (eq (car mac) 'lambda)
+ (setq mac (assoc 'kmacro-exec-ring-item mac))
+ (consp (cdr mac))
+ (consp (car (cdr mac)))
+ (consp (cdr (car (cdr mac))))
+ (setq mac (car (cdr (car (cdr mac)))))
+ (listp mac)
+ (= (length mac) 3)
+ (arrayp (car mac))
+ mac))
+
+
(defun kmacro-bind-to-key (arg)
"When not defining or executing a macro, offer to bind last macro to a key.
The key sequences [C-x C-k 0] through [C-x C-k 9] and [C-x C-k A]
@@ -775,10 +799,7 @@ may be shaded by a local key binding."
(format-kbd-macro key-seq)
cmd))))
(define-key global-map key-seq
- `(lambda (&optional arg)
- "Keyboard macro."
- (interactive "p")
- (kmacro-exec-ring-item ',(kmacro-ring-head) arg)))
+ (kmacro-lambda-form (kmacro-ring-head)))
(message "Keyboard macro bound to %s" (format-kbd-macro key-seq))))))
@@ -798,11 +819,7 @@ Such a \"function\" cannot be called from Lisp, but it is a valid editor command
symbol))
(if (string-equal symbol "")
(error "No command name given"))
- (fset symbol
- `(lambda (&optional arg)
- "Keyboard macro."
- (interactive "p")
- (kmacro-exec-ring-item ',(kmacro-ring-head) arg)))
+ (fset symbol (kmacro-lambda-form (kmacro-ring-head)))
(put symbol 'kmacro t))
diff --git a/lisp/newcomment.el b/lisp/newcomment.el
index 120777ab704..5711e7903ad 100644
--- a/lisp/newcomment.el
+++ b/lisp/newcomment.el
@@ -423,7 +423,7 @@ and raises an error or returns nil if NOERROR is non-nil."
(defun comment-beginning ()
"Find the beginning of the enclosing comment.
Returns nil if not inside a comment, else moves point and returns
-the same as `comment-search-forward'."
+the same as `comment-search-backward'."
;; HACK ATTACK!
;; We should really test `in-string-p' but that can be expensive.
(unless (eq (get-text-property (point) 'face) 'font-lock-string-face)
@@ -435,7 +435,7 @@ the same as `comment-search-forward'."
(and
;; For modes where comment-start and comment-end are the same,
;; the search above may have found a `ce' rather than a `cs'.
- (or (not (looking-at comment-end-skip))
+ (or (if comment-end-skip (not (looking-at comment-end-skip)))
;; Maybe font-lock knows that it's a `cs'?
(eq (get-text-property (match-end 0) 'face)
'font-lock-comment-face)
diff --git a/lisp/progmodes/cc-langs.el b/lisp/progmodes/cc-langs.el
index 6aeb70ba4e3..6a36f89c8d3 100644
--- a/lisp/progmodes/cc-langs.el
+++ b/lisp/progmodes/cc-langs.el
@@ -124,6 +124,9 @@
(cc-require 'cc-defs)
(cc-require 'cc-vars)
+;; This file is not always loaded. See note above.
+(cc-external-require 'cl)
+
;;; Setup for the `c-lang-defvar' system.
diff --git a/lisp/term.el b/lisp/term.el
index 35bb74834b5..07702551718 100644
--- a/lisp/term.el
+++ b/lisp/term.el
@@ -2586,8 +2586,9 @@ See `term-prompt-regexp'."
(- (term-vertical-motion -9999))))))))
(defun term-adjust-current-row-cache (delta)
- (if term-current-row
- (setq term-current-row (+ term-current-row delta))))
+ (when term-current-row
+ (setq term-current-row
+ (max 0 (+ term-current-row delta)))))
(defun term-terminal-pos ()
(save-excursion ; save-restriction
@@ -2762,7 +2763,17 @@ See `term-prompt-regexp'."
(when (not (or (eobp) term-insert-mode))
(setq pos (point))
(term-move-columns columns)
- (delete-region pos (point))))
+ (delete-region pos (point)))
+ ;; In insert if the if the current line
+ ;; has become too long it needs to be
+ ;; chopped off.
+ (when term-insert-mode
+ (setq pos (point))
+ (end-of-line)
+ (when (> (current-column) term-width)
+ (delete-region (- (point) (- (current-column) term-width))
+ (point)))
+ (goto-char pos)))
(setq term-current-column nil)
(put-text-property old-point (point)
@@ -2776,12 +2787,21 @@ See `term-prompt-regexp'."
(setq i (1- funny)))
((and (setq term-terminal-state 0)
(eq char ?\^I)) ; TAB (terminfo: ht)
- ;; FIXME: Does not handle line wrap!
(setq count (term-current-column))
- (setq count (+ count 8 (- (mod count 8))))
- (if (< (move-to-column count nil) count)
- (term-insert-char char 1))
- (setq term-current-column count))
+ ;; The line cannot exceed term-width. TAB at
+ ;; the end of a line should not cause wrapping.
+ (setq count (min term-width
+ (+ count 8 (- (mod count 8)))))
+ (if (> term-width count)
+ (progn
+ (term-move-columns
+ (- count (term-current-column)))
+ (setq term-current-column count))
+ (when (> term-width (term-current-column))
+ (term-move-columns
+ (1- (- term-width (term-current-column)))))
+ (when (= term-width (term-current-column))
+ (term-move-columns -1))))
((eq char ?\r)
;; Optimize CRLF at end of buffer:
(cond ((and (< (setq temp (1+ i)) str-length)
@@ -2849,8 +2869,14 @@ See `term-prompt-regexp'."
(term-handle-deferred-scroll)
(term-down 1 t)
(setq term-terminal-state 0))
- ((eq char ?M) ;; scroll reversed
- (term-insert-lines 1)
+ ;; ((eq char ?E) ;; (terminfo: nw), not used for
+ ;; ;; now, but this is a working
+ ;; ;; implementation
+ ;; (term-down 1)
+ ;; (term-goto term-current-row 0)
+ ;; (setq term-terminal-state 0))
+ ((eq char ?M) ;; scroll reversed (terminfo: ri)
+ (term-down -1)
(setq term-terminal-state 0))
((eq char ?7) ;; Save cursor (terminfo: sc)
(term-handle-deferred-scroll)
@@ -2863,6 +2889,13 @@ See `term-prompt-regexp'."
(term-goto (car term-saved-cursor)
(cdr term-saved-cursor)))
(setq term-terminal-state 0))
+ ;; The \E#8 reset sequence for xterm. We
+ ;; probably don't need to handle it, but this
+ ;; is the code to parse it.
+ ;; ((eq char ?#)
+ ;; (when (eq (aref str (1+ i)) ?8)
+ ;; (setq i (1+ i))
+ ;; (setq term-terminal-state 0)))
((setq term-terminal-state 0))))
((eq term-terminal-state 3) ; Seen Esc [
(cond ((and (>= char ?0) (<= char ?9))
@@ -3119,7 +3152,10 @@ See `term-prompt-regexp'."
(defun term-handle-ansi-escape (proc char)
(cond
- ((eq char ?H) ; cursor motion
+ ((or (eq char ?H) ; cursor motion (terminfo: cup)
+ ;; (eq char ?f) ; xterm seems to handle this sequence too, not
+ ;; needed for now
+ )
(if (<= term-terminal-parameter 0)
(setq term-terminal-parameter 1))
(if (<= term-terminal-previous-parameter 0)
@@ -3131,17 +3167,21 @@ See `term-prompt-regexp'."
(term-goto
(1- term-terminal-previous-parameter)
(1- term-terminal-parameter)))
- ;; \E[A - cursor up (terminfo: cuu1)
+ ;; \E[A - cursor up (terminfo: cuu, cuu1)
((eq char ?A)
(term-handle-deferred-scroll)
(term-down (- (max 1 term-terminal-parameter)) t))
- ;; \E[B - cursor down
+ ;; \E[B - cursor down (terminfo: cud)
((eq char ?B)
(term-down (max 1 term-terminal-parameter) t))
- ;; \E[C - cursor right
+ ;; \E[C - cursor right (terminfo: cuf)
((eq char ?C)
- (term-move-columns (max 1 term-terminal-parameter)))
- ;; \E[D - cursor left
+ (term-move-columns
+ (max 1
+ (if (>= (+ term-terminal-parameter (term-current-column)) term-width)
+ (- term-width (term-current-column) 1)
+ term-terminal-parameter))))
+ ;; \E[D - cursor left (terminfo: cub)
((eq char ?D)
(term-move-columns (- (max 1 term-terminal-parameter))))
;; \E[J - clear to end of screen (terminfo: ed, clear)
@@ -3199,7 +3239,7 @@ See `term-prompt-regexp'."
(1+ (term-current-row))
(1+ (term-horizontal-column)))))
;; \E[r - Set scrolling region
- ((eq char ?r)
+ ((eq char ?r) ;; (terminfo: csr)
(term-scroll-region
(1- term-terminal-previous-parameter)
term-terminal-parameter))
@@ -3221,7 +3261,10 @@ The top-most line is line 0."
(setq term-scroll-with-delete
(or (term-using-alternate-sub-buffer)
(not (and (= term-scroll-start 0)
- (= term-scroll-end term-height))))))
+ (= term-scroll-end term-height)))))
+ (term-move-columns (- (term-current-column)))
+ (term-goto
+ term-scroll-start (term-current-column)))
;; (defun term-switch-to-alternate-sub-buffer (set)
;; ;; If asked to switch to (from) the alternate sub-buffer, and already (not)
@@ -3599,8 +3642,8 @@ Should only be called when point is at the start of a screen line."
(end-region (if (eq kind 1) (point) (point-max))))
(delete-region start-region end-region)
(term-unwrap-line)
- (if (eq kind 1)
- (term-insert-char ?\n row))
+ (when (eq kind 1)
+ (term-insert-char ?\n row))
(setq term-current-column nil)
(setq term-current-row nil)
(term-goto row col)))))
diff --git a/lisp/textmodes/tex-mode.el b/lisp/textmodes/tex-mode.el
index 08d25997a11..24347479e57 100644
--- a/lisp/textmodes/tex-mode.el
+++ b/lisp/textmodes/tex-mode.el
@@ -1,7 +1,7 @@
;;; tex-mode.el --- TeX, LaTeX, and SliTeX mode commands -*- coding: utf-8 -*-
-;; Copyright (C) 1985,86,89,92,94,95,96,97,98,1999,2002,03,2004
-;; Free Software Foundation, Inc.
+;; Copyright (C) 1985, 1986, 1989, 1992, 1994, 1995, 1996, 1997, 1998, 1999,
+;; 2002, 2003, 2004 Free Software Foundation, Inc.
;; Maintainer: FSF
;; Keywords: tex
@@ -196,7 +196,11 @@ use."
:group 'tex-view)
;;;###autoload
-(defcustom tex-dvi-view-command '(if (eq window-system 'x) "xdvi" "dvi2tty * | cat -s")
+(defcustom tex-dvi-view-command
+ '(cond
+ ((eq window-system 'x) "xdvi")
+ ((eq window-system 'w32) "yap")
+ (t "dvi2tty * | cat -s"))
"*Command used by \\[tex-view] to display a `.dvi' file.
If it is a string, that specifies the command directly.
If this string contains an asterisk (`*'), that is replaced by the file name;
@@ -453,7 +457,8 @@ An alternative value is \" . \", if you use a font with a narrow period."
'("input" "include" "includeonly" "bibliography"
"epsfig" "psfig" "epsf" "nofiles" "usepackage"
"documentstyle" "documentclass" "verbatiminput"
- "includegraphics" "includegraphics*")
+ "includegraphics" "includegraphics*"
+ "url" "nolinkurl")
t))
;; Miscellany.
(slash "\\\\")
@@ -771,8 +776,10 @@ Inherits `shell-mode-map' with a few additions.")
"part" "chapter" "newcommand"
"renewcommand") 'words)
"\\|NeedsTeXFormat{LaTeX")))
- (if (looking-at
- "document\\(style\\|class\\)\\(\\[.*\\]\\)?{slides}")
+ (if (and (looking-at
+ "document\\(style\\|class\\)\\(\\[.*\\]\\)?{slides}")
+ ;; SliTeX is almost never used any more nowadays.
+ (tex-executable-exists-p slitex-run-command))
'slitex-mode
'latex-mode)
'plain-tex-mode))))
@@ -1219,8 +1226,13 @@ A prefix arg inhibits the checking."
(defvar latex-block-default "enumerate")
(defvar latex-block-args-alist
- '(("array" nil ?\{ (skeleton-read "[options]: ") ?\})
- ("tabular" nil ?\{ (skeleton-read "[options]: ") ?\}))
+ '(("array" nil ?\{ (skeleton-read "Format: ") ?\})
+ ("tabular" nil ?\{ (skeleton-read "Format: ") ?\})
+ ("minipage" nil ?\{ (skeleton-read "Size: ") ?\})
+ ("picture" nil ?\( (skeleton-read "SizeX,SizeY: ") ?\))
+ ;; FIXME: This is right for Prosper, but not for seminar.
+ ;; ("slide" nil ?\{ (skeleton-read "Title: ") ?\})
+ )
"Skeleton element to use for arguments to particular environments.
Every element of the list has the form (NAME . SKEL-ELEM) where NAME is
the name of the environment and SKEL-ELEM is an element to use in
@@ -1229,8 +1241,11 @@ a skeleton (see `skeleton-insert').")
(defvar latex-block-body-alist
'(("enumerate" nil '(latex-insert-item) > _)
("itemize" nil '(latex-insert-item) > _)
- ("table" nil "\\caption{" > - "}" > \n _)
- ("figure" nil > _ \n "\\caption{" > _ "}" >))
+ ("table" nil "\\caption{" > (skeleton-read "Caption: ") "}" > \n
+ '(if (and (boundp 'reftex-mode) reftex-mode) (reftex-label "table"))
+ \n _)
+ ("figure" nil > _ \n "\\caption{" > (skeleton-read "Caption: ") "}" > \n
+ '(if (and (boundp 'reftex-mode) reftex-mode) (reftex-label "table"))))
"Skeleton element to use for the body of particular environments.
Every element of the list has the form (NAME . SKEL-ELEM) where NAME is
the name of the environment and SKEL-ELEM is an element to use in
@@ -1254,7 +1269,8 @@ Puts point on a blank line between them."
choice)
\n "\\begin{" str "}"
(cdr (assoc str latex-block-args-alist))
- > \n (or (cdr (assoc str latex-block-body-alist)) '(nil > _)) \n
+ > \n (or (cdr (assoc str latex-block-body-alist)) '(nil > _))
+ (unless (bolp) '\n)
"\\end{" str "}" > \n)
(define-skeleton latex-insert-item
@@ -1598,7 +1614,7 @@ If NOT-ALL is non-nil, save the `.dvi' file."
("texindex %r.??")
("dvipdfm %r" "%r.dvi" "%r.pdf")
("dvipdf %r" "%r.dvi" "%r.pdf")
- ("dvips %r" "%r.dvi" "%r.ps")
+ ("dvips -o %r.ps %r" "%r.dvi" "%r.ps")
("ps2pdf %r.ps" "%r.ps" "%r.pdf")
("gv %r.ps &" "%r.ps")
("gv %r.pdf &" "%r.pdf")
@@ -1767,7 +1783,7 @@ FILE is typically the output DVI or PDF file."
(not (tex-uptodate-p (format-spec out fspec)))))))
(defun tex-compile-default (fspec)
- "Guess a default command given the format-spec FSPEC."
+ "Guess a default command given the `format-spec' FSPEC."
;; TODO: Learn to do latex+dvips!
(let ((cmds nil)
(unchanged-in nil))
@@ -1777,6 +1793,9 @@ FILE is typically the output DVI or PDF file."
(if (tex-command-active-p cmd fspec)
(push cmd cmds)
(push (nth 1 cmd) unchanged-in))))
+ ;; If no command seems to be applicable, arbitrarily pick the first one.
+ (unless cmds
+ (setq cmds (list (car tex-compile-commands))))
;; Remove those commands whose input was considered stable for
;; some other command (typically if (t . "%.pdf") is inactive
;; then we're using pdflatex and the fact that the dvi file
@@ -2261,6 +2280,7 @@ Runs the shell command defined by `tex-show-queue-command'."
(defvar tex-indent-basic 2)
(defvar tex-indent-item tex-indent-basic)
(defvar tex-indent-item-re "\\\\\\(bib\\)?item\\>")
+(defvar latex-noindent-environments '("document"))
(defvar tex-latex-indent-syntax-table
(let ((st (make-syntax-table tex-mode-syntax-table)))
@@ -2311,7 +2331,6 @@ There might be text before point."
(latex-find-indent 'virtual))))
;; Default (maybe an argument)
(let ((pos (point))
- (char (char-after))
;; Outdent \item if necessary.
(indent (if (looking-at tex-indent-item-re) (- tex-indent-item) 0))
up-list-pos)
@@ -2329,6 +2348,17 @@ There might be text before point."
;; Have to indent relative to the open-paren.
(goto-char up-list-pos)
(if (and (not tex-indent-allhanging)
+ (save-excursion
+ ;; Make sure we're an argument to a macro and
+ ;; that the macro is at the beginning of a line.
+ (condition-case nil
+ (progn
+ (while (eq (char-syntax (char-after)) ?\()
+ (forward-sexp -1))
+ (and (eq (char-syntax (char-after)) ?/)
+ (progn (skip-chars-backward " \t&")
+ (bolp))))
+ (scan-error nil)))
(> pos (progn (latex-down-list)
(forward-comment (point-max))
(point))))
@@ -2336,18 +2366,24 @@ There might be text before point."
(current-column)
;; We're the first element after a hanging brace.
(goto-char up-list-pos)
- (+ indent tex-indent-basic (latex-find-indent 'virtual))))
+ (+ (if (and (looking-at "\\\\begin *{\\([^\n}]+\\)")
+ (member (match-string 1)
+ latex-noindent-environments))
+ 0 tex-indent-basic)
+ indent (latex-find-indent 'virtual))))
;; We're now at the "beginning" of a line.
((not (and (not virtual) (eq (char-after) ?\\)))
;; Nothing particular here: just keep the same indentation.
(+ indent (current-column)))
;; We're now looking at a macro call.
- ((looking-at tex-indent-item-re)
- ;; Indenting relative to an item, have to re-add the outdenting.
+ ((looking-at tex-indent-item-re)
+ ;; Indenting relative to an item, have to re-add the outdenting.
(+ indent (current-column) tex-indent-item))
(t
(let ((col (current-column)))
- (if (or (null char) (not (eq (char-syntax char) ?\()))
+ (if (or (not (eq (char-syntax (or (char-after pos) ?\ )) ?\())
+ ;; Can't be an arg if there's an empty line inbetween.
+ (save-excursion (re-search-forward "^[ \t]*$" pos t)))
;; If the first char was not an open-paren, there's
;; a risk that this is really not an argument to the
;; macro at all.
@@ -2422,5 +2458,5 @@ There might be text before point."
(provide 'tex-mode)
-;;; arch-tag: c0a680b1-63aa-4547-84b9-4193c29c0080
+;; arch-tag: c0a680b1-63aa-4547-84b9-4193c29c0080
;;; tex-mode.el ends here