Using saved parent location: http://bzr.savannah.gnu.org/r/emacs/trunk/ Now on revision 101800. ------------------------------------------------------------ revno: 101800 committer: Katsumi Yamaoka branch nick: trunk timestamp: Tue 2010-10-05 06:36:32 +0000 message: Merge changes made ein Gnus trunk. gnus-util.el (gnus-completing-read-function): Exclude gnus-icompleting-read and gnus-ido-completing-read from candidates for XEmacs since iswitchb.el is very old and ido.el is unavailable in XEmacs. gnus-registry.el (gnus-registry-install-nnregistry): Rewrite so as not to use `delete-dups' that is unavailable in XEmacs 21.4. diff: === modified file 'lisp/gnus/ChangeLog' --- lisp/gnus/ChangeLog 2010-10-05 03:48:30 +0000 +++ lisp/gnus/ChangeLog 2010-10-05 06:36:32 +0000 @@ -1,5 +1,13 @@ 2010-10-05 Katsumi Yamaoka + * gnus-util.el (gnus-completing-read-function): Exclude + gnus-icompleting-read and gnus-ido-completing-read from candidates for + XEmacs since iswitchb.el is very old and ido.el is unavailable in + XEmacs. + + * gnus-registry.el (gnus-registry-install-nnregistry): Rewrite so as + not to use `delete-dups' that is unavailable in XEmacs 21.4. + * gnus-html.el: Don't require help-fns under XEmacs. (gnus-html-schedule-image-fetching): Work for XEmacs. === modified file 'lisp/gnus/gnus-registry.el' --- lisp/gnus/gnus-registry.el 2010-10-01 23:08:25 +0000 +++ lisp/gnus/gnus-registry.el 2010-10-05 06:36:32 +0000 @@ -1153,13 +1153,16 @@ (defun gnus-registry-install-nnregistry () "Install the nnregistry refer method in `gnus-refer-article-method'." (interactive) - (setq gnus-refer-article-method - (delete-dups - (append - (if (listp gnus-refer-article-method) - gnus-refer-article-method - (list gnus-refer-article-method)) - (list 'nnregistry))))) + (cond ((eq 'nnregistry gnus-refer-article-method)) + ((null gnus-refer-article-method) + (setq gnus-refer-article-method 'nnregistry)) + ((consp gnus-refer-article-method) + (unless (memq 'nnregistry gnus-refer-article-method) + (setq gnus-refer-article-method + (append gnus-refer-article-method '(nnregistry))))) + (t + (setq gnus-refer-article-method + (list gnus-refer-article-method 'nnregistry))))) (defun gnus-registry-unload-hook () "Uninstall the registry hooks." === modified file 'lisp/gnus/gnus-util.el' --- lisp/gnus/gnus-util.el 2010-10-04 22:26:51 +0000 +++ lisp/gnus/gnus-util.el 2010-10-05 06:36:32 +0000 @@ -48,15 +48,18 @@ "Function use to do completing read." :version "24.1" :group 'gnus-meta - :type '(radio (function-item + :type `(radio (function-item :doc "Use Emacs standard `completing-read' function." gnus-emacs-completing-read) - (function-item - :doc "Use `ido-completing-read' function." - gnus-ido-completing-read) - (function-item - :doc "Use iswitchb based completing-read function." - gnus-iswitchb-completing-read))) + ;; iswitchb.el is very old and ido.el is unavailable + ;; in XEmacs, so we exclude those function items. + ,@(unless (featurep 'xemacs) + '((function-item + :doc "Use `ido-completing-read' function." + gnus-ido-completing-read) + (function-item + :doc "Use iswitchb based completing-read function." + gnus-iswitchb-completing-read))))) (defcustom gnus-completion-styles (if (and (boundp 'completion-styles-alist) ------------------------------------------------------------ revno: 101799 committer: Glenn Morris branch nick: trunk timestamp: Mon 2010-10-04 21:19:58 -0700 message: NEWS update. diff: === modified file 'etc/NEWS' --- etc/NEWS 2010-10-04 00:43:11 +0000 +++ etc/NEWS 2010-10-05 04:19:58 +0000 @@ -565,6 +565,9 @@ have been removed: checkdoc-minor-keymap, vc-header-alist, directory-sep-char +** The following files, obsolete since at least Emacs 21.1, have been removed: +sc.el, x-menu.el, rnews.el, rnewspost.el + * Lisp changes in Emacs 24.1 ------------------------------------------------------------ revno: 101798 committer: Glenn Morris branch nick: trunk timestamp: Mon 2010-10-04 21:17:51 -0700 message: * lisp/obsolete/rnews.el, lisp/obsolete/rnewspost.el: Remove files. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2010-10-04 19:44:08 +0000 +++ lisp/ChangeLog 2010-10-05 04:17:51 +0000 @@ -1,3 +1,7 @@ +2010-10-05 Glenn Morris + + * obsolete/rnews.el, obsolete/rnewspost.el: Remove files. + 2010-10-04 Michael Albinus Continue reorganization of load dependencies. (Bug#7156) === removed file 'lisp/obsolete/rnews.el' --- lisp/obsolete/rnews.el 2010-01-13 08:35:10 +0000 +++ lisp/obsolete/rnews.el 1970-01-01 00:00:00 +0000 @@ -1,981 +0,0 @@ -;;; rnews.el --- USENET news reader for GNU Emacs - -;; Copyright (C) 1985, 1986, 1987, 2001, 2002, 2003, 2004, -;; 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. - -;; Maintainer: FSF -;; Keywords: news - -;; This file is part of GNU Emacs. - -;; GNU Emacs is free software: you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; GNU Emacs is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with GNU Emacs. If not, see . - -;;; Commentary: - -;; This file has been obsolete since Emacs 21.1. - -;;; Change Log: - -;; Created Sun Mar 10,1985 at 21:35:01 ads and sundar@hernes.ai.mit.edu -;; Should do the point pdl stuff sometime -;; finito except pdl.... Sat Mar 16,1985 at 06:43:44 -;; lets keep the summary stuff out until we get it working .. -;; sundar@hermes.ai.mit.edu Wed Apr 10,1985 at 16:32:06 -;; hack slash maim. mly@gnu.org Thu 18 Apr, 1985 06:11:14 -;; modified to correct reentrance bug, to not bother with groups that -;; received no new traffic since last read completely, to find out -;; what traffic a group has available much more quickly when -;; possible, to do some completing reads for group names - should -;; be much faster... -;; KING@KESTREL.arpa, Thu Mar 13 09:03:28 1986 -;; made news-{next,previous}-group skip groups with no new messages; and -;; added checking for unsubscribed groups to news-add-news-group -;; tower@gnu.org Jul 18 1986 -;; bound rmail-output to C-o; and changed header-field commands binding to -;; agree with the new C-c C-f usage in sendmail -;; tower@gnu.org Sep 3 1986 -;; added news-rotate-buffer-body -;; tower@gnu.org Oct 17 1986 -;; made messages more user friendly, cleaned up news-inews -;; move posting and mail code to new file rnewpost.el -;; tower@gnu.org Oct 29 1986 -;; added caesar-region, rename news-caesar-buffer-body, hacked accordingly -;; tower@gnu.org Nov 21 1986 -;; added tower@gnu.org 22 Apr 87 - -;;; Code: - -(require 'mail-utils) -(require 'sendmail) - -(defvar caesar-translate-table) -(defvar minor-modes) -(defvar news-buffer-save) -(defvar news-group-name) -(defvar news-minor-modes) - -(autoload 'rmail-output "rmailout" - "Append this message to Unix mail file named FILE-NAME." - t) - -(autoload 'news-reply "rnewspost" - "Compose and post a reply to the current article on USENET. -While composing the reply, use \\[mail-yank-original] to yank the original -message into it." - t) - -(autoload 'news-mail-other-window "rnewspost" - "Send mail in another window. -While composing the message, use \\[mail-yank-original] to yank the -original message into it." - t) - -(autoload 'news-post-news "rnewspost" - "Begin editing a new USENET news article to be posted." - t) - -(autoload 'news-mail-reply "rnewspost" - "Mail a reply to the author of the current article. -While composing the reply, use \\[mail-yank-original] to yank the original -message into it." - t) - -(defvar news-group-hook-alist nil - "Alist of (GROUP-REGEXP . HOOK) pairs. -Just before displaying a message, each HOOK is called -if its GROUP-REGEXP matches the current newsgroup name.") - -(defvar rmail-last-file (expand-file-name "~/mbox.news")) - -;Now in paths.el. -;(defvar news-path "/usr/spool/news/" -; "The root directory below which all news files are stored.") - -(defvar news-startup-file "$HOME/.newsrc" "Contains ~/.newsrc") -(defvar news-certification-file "$HOME/.news-dates" "Contains ~/.news-dates") - -;; random headers that we decide to ignore. -(defvar news-ignored-headers - "^Path:\\|^Posting-Version:\\|^Article-I.D.:\\|^Expires:\\|^Date-Received:\\|^References:\\|^Control:\\|^Xref:\\|^Lines:\\|^Posted:\\|^Relay-Version:\\|^Message-ID:\\|^Nf-ID:\\|^Nf-From:\\|^Approved:\\|^Sender:" - "All random fields within the header of a message.") - -(defvar news-mode-map nil) -(defvar news-read-first-time-p t) -;; Contains the (dotified) news groups of which you are a member. -(defvar news-user-group-list nil) - -(defvar news-current-news-group nil) -(defvar news-current-group-begin nil) -(defvar news-current-group-end nil) -(defvar news-current-certifications nil - "An assoc list of a group name and the time at which it is -known that the group had no new traffic") -(defvar news-current-certifiable nil - "The time when the directory we are now working on was written") - -(defvar news-message-filter nil - "User specifiable filter function that will be called during -formatting of the news file") - -;(defvar news-mode-group-string "Starting-Up" -; "Mode line group name info is held in this variable") -(defvar news-list-of-files nil - "Global variable in which we store the list of files -associated with the current newsgroup") -(defvar news-list-of-files-possibly-bogus nil - "variable indicating we only are guessing at which files are available. -Not currently used.") - -;; association list in which we store lists of the form -;; (pointified-group-name (first last old-last)) -(defvar news-group-article-assoc nil) - -(defvar news-current-message-number 0 "Displayed Article Number") -(defvar news-total-current-group 0 "Total no of messages in group") - -(defvar news-unsubscribe-groups ()) -(defvar news-point-pdl () "List of visited news messages.") -(defvar news-no-jumps-p t) -(defvar news-buffer () "Buffer into which news files are read.") - -(defmacro news-push (item ref) - (list 'setq ref (list 'cons item ref))) - -(defmacro news-cadr (x) (list 'car (list 'cdr x))) -(defmacro news-cdar (x) (list 'cdr (list 'car x))) -(defmacro news-caddr (x) (list 'car (list 'cdr (list 'cdr x)))) -(defmacro news-cadar (x) (list 'car (list 'cdr (list 'car x)))) -(defmacro news-caadr (x) (list 'car (list 'car (list 'cdr x)))) -(defmacro news-cdadr (x) (list 'cdr (list 'car (list 'cdr x)))) - -(defmacro news-wins (pfx index) - `(file-exists-p (concat ,pfx "/" (int-to-string ,index)))) - -(defvar news-max-plausible-gap 2 - "* In an rnews directory, the maximum possible gap size. -A gap is a sequence of missing messages between two messages that exist. -An empty file does not contribute to a gap -- it ends one.") - -(defun news-find-first-and-last (prefix base) - (and (news-wins prefix base) - (cons (news-find-first-or-last prefix base -1) - (news-find-first-or-last prefix base 1)))) - -(defmacro news-/ (a1 a2) -;; a form of / that guarantees that (/ -1 2) = 0 - (if (zerop (/ -1 2)) - `(/ ,a1 ,a2) - `(if (< ,a1 0) - (- (/ (- ,a1) ,a2)) - (/ ,a1 ,a2)))) - -(defun news-find-first-or-last (pfx base dirn) - ;; first use powers of two to find a plausible ceiling - (let ((original-dir dirn)) - (while (news-wins pfx (+ base dirn)) - (setq dirn (* dirn 2))) - (setq dirn (news-/ dirn 2)) - ;; Then use a binary search to find the high water mark - (let ((offset (news-/ dirn 2))) - (while (/= offset 0) - (if (news-wins pfx (+ base dirn offset)) - (setq dirn (+ dirn offset))) - (setq offset (news-/ offset 2)))) - ;; If this high-water mark is bogus, recurse. - (let ((offset (* news-max-plausible-gap original-dir))) - (while (and (/= offset 0) (not (news-wins pfx (+ base dirn offset)))) - (setq offset (- offset original-dir))) - (if (= offset 0) - (+ base dirn) - (news-find-first-or-last pfx (+ base dirn offset) original-dir))))) - -(defun rnews () -"Read USENET news for groups for which you are a member and add or -delete groups. -You can reply to articles posted and send articles to any group. - -Type \\[describe-mode] once reading news to get a list of rnews commands." - (interactive) - (let ((last-buffer (buffer-name))) - (make-local-variable 'rmail-last-file) - (switch-to-buffer (setq news-buffer (get-buffer-create "*news*"))) - (news-mode) - (setq news-buffer-save last-buffer) - (setq buffer-read-only nil) - (erase-buffer) - (setq buffer-read-only t) - (set-buffer-modified-p t) - (sit-for 0) - (message "Getting new USENET news...") - (news-set-mode-line) - (news-get-certifications) - (news-get-new-news))) - -(defun news-group-certification (group) - (cdr-safe (assoc group news-current-certifications))) - - -(defun news-set-current-certifiable () - ;; Record the date that corresponds to the directory you are about to check - (let ((file (concat news-path - (string-subst-char ?/ ?. news-current-news-group)))) - (setq news-current-certifiable - (nth 5 (file-attributes - (or (file-symlink-p file) file)))))) - -(defun news-get-certifications () - ;; Read the certified-read file from last session - (save-excursion - (save-window-excursion - (setq news-current-certifications - (car-safe - (condition-case var - (let* - ((file (substitute-in-file-name news-certification-file)) - (buf (find-file-noselect file))) - (and (file-exists-p file) - (progn - (switch-to-buffer buf 'norecord) - (unwind-protect - (read-from-string (buffer-string)) - (kill-buffer buf))))) - (error nil))))))) - -(defun news-write-certifications () - ;; Write a certification file. - ;; This is an assoc list of group names with doubletons that represent - ;; mod times of the directory when group is read completely. - (save-excursion - (save-window-excursion - (with-output-to-temp-buffer - "*CeRtIfIcAtIoNs*" - (print news-current-certifications)) - (let ((buf (get-buffer "*CeRtIfIcAtIoNs*"))) - (switch-to-buffer buf) - (write-file (substitute-in-file-name news-certification-file)) - (kill-buffer buf))))) - -(defun news-set-current-group-certification () - (let ((cgc (assoc news-current-news-group news-current-certifications))) - (if cgc (setcdr cgc news-current-certifiable) - (news-push (cons news-current-news-group news-current-certifiable) - news-current-certifications)))) - -(defun news-set-message-counters () - "Scan through current news-groups filelist to figure out how many messages -are there. Set counters for use with minor mode display." - (if (null news-list-of-files) - (setq news-current-message-number 0))) - -(if news-mode-map - nil - (setq news-mode-map (make-keymap)) - (suppress-keymap news-mode-map) - (define-key news-mode-map "." 'beginning-of-buffer) - (define-key news-mode-map " " 'scroll-up) - (define-key news-mode-map "\177" 'scroll-down) - (define-key news-mode-map "n" 'news-next-message) - (define-key news-mode-map "c" 'news-make-link-to-message) - (define-key news-mode-map "p" 'news-previous-message) - (define-key news-mode-map "j" 'news-goto-message) - (define-key news-mode-map "q" 'news-exit) - (define-key news-mode-map "e" 'news-exit) - (define-key news-mode-map "\ej" 'news-goto-news-group) - (define-key news-mode-map "\en" 'news-next-group) - (define-key news-mode-map "\ep" 'news-previous-group) - (define-key news-mode-map "l" 'news-list-news-groups) - (define-key news-mode-map "?" 'describe-mode) - (define-key news-mode-map "g" 'news-get-new-news) - (define-key news-mode-map "f" 'news-reply) - (define-key news-mode-map "m" 'news-mail-other-window) - (define-key news-mode-map "a" 'news-post-news) - (define-key news-mode-map "r" 'news-mail-reply) - (define-key news-mode-map "o" 'news-save-item-in-file) - (define-key news-mode-map "\C-o" 'rmail-output) - (define-key news-mode-map "t" 'news-show-all-headers) - (define-key news-mode-map "x" 'news-force-update) - (define-key news-mode-map "A" 'news-add-news-group) - (define-key news-mode-map "u" 'news-unsubscribe-current-group) - (define-key news-mode-map "U" 'news-unsubscribe-group) - (define-key news-mode-map "\C-c\C-r" 'news-caesar-buffer-body)) - -(defun news-mode () - "News Mode is used by M-x rnews for reading USENET Newsgroups articles. -New readers can find additional help in newsgroup: news.announce.newusers . -All normal editing commands are turned off. -Instead, these commands are available: - -. move point to front of this news article (same as Meta-<). -Space scroll to next screen of this news article. -Delete scroll down previous page of this news article. -n move to next news article, possibly next group. -p move to previous news article, possibly previous group. -j jump to news article specified by numeric position. -M-j jump to news group. -M-n goto next news group. -M-p goto previous news group. -l list all the news groups with current status. -? print this help message. -C-c C-r caesar rotate all letters by 13 places in the article's body (rot13). -g get new USENET news. -f post a reply article to USENET. -a post an original news article. -A add a newsgroup. -o save the current article in the named file (append if file exists). -C-o output this message to a Unix-format mail file (append it). -c \"copy\" (actually link) current or prefix-arg msg to file. - warning: target directory and message file must be on same device - (UNIX magic) -t show all the headers this news article originally had. -q quit reading news after updating .newsrc file. -e exit updating .newsrc file. -m mail a news article. Same as C-x 4 m. -x update last message seen to be the current message. -r mail a reply to this news article. Like m but initializes some fields. -u unsubscribe from current newsgroup. -U unsubscribe from specified newsgroup." - (interactive) - (kill-all-local-variables) - (make-local-variable 'news-read-first-time-p) - (setq news-read-first-time-p t) - (make-local-variable 'news-current-news-group) -; (setq news-current-news-group "??") - (make-local-variable 'news-current-group-begin) - (setq news-current-group-begin 0) - (make-local-variable 'news-current-message-number) - (setq news-current-message-number 0) - (make-local-variable 'news-total-current-group) - (make-local-variable 'news-buffer-save) - (make-local-variable 'version-control) - (setq version-control 'never) - (make-local-variable 'news-point-pdl) -; This breaks it. I don't have time to figure out why. -- RMS -; (make-local-variable 'news-group-article-assoc) - (setq major-mode 'news-mode) - (setq mode-line-process '(news-minor-modes)) - (setq mode-name "NEWS") - (news-set-mode-line) - (set-syntax-table text-mode-syntax-table) - (use-local-map news-mode-map) - (setq local-abbrev-table text-mode-abbrev-table) - (run-mode-hooks 'news-mode-hook)) - -(defun string-subst-char (new old string) - (let (index) - (setq old (regexp-quote (char-to-string old)) - string (substring string 0)) - (while (setq index (string-match old string)) - (aset string index new))) - string) - -;; update read message number -(defmacro news-update-message-read (ngroup nno) - (list 'setcar - (list 'news-cdadr - (list 'assoc ngroup 'news-group-article-assoc)) - nno)) - -(defun news-parse-range (number-string) - "Parse string representing range of numbers of he form - -to a list (a . b)" - (let ((n (string-match "-" number-string))) - (if n - (cons (string-to-number (substring number-string 0 n)) - (string-to-number (substring number-string (1+ n)))) - (setq n (string-to-number number-string)) - (cons n n)))) - -;(defun is-in (elt lis) -; (catch 'foo -; (while lis -; (if (equal (car lis) elt) -; (throw 'foo t) -; (setq lis (cdr lis)))))) - -(defun news-get-new-news () - "Get new USENET news, if there is any for the current user." - (interactive) - (if (not (null news-user-group-list)) - (news-update-newsrc-file)) - (setq news-group-article-assoc ()) - (setq news-user-group-list ()) - (message "Looking up %s file..." news-startup-file) - (let ((file (substitute-in-file-name news-startup-file)) - (temp-user-groups ())) - (save-excursion - (let ((newsrcbuf (find-file-noselect file)) - start end endofline tem) - (set-buffer newsrcbuf) - (goto-char 0) - (while (search-forward ": " nil t) - (setq end (point)) - (beginning-of-line) - (setq start (point)) - (end-of-line) - (setq endofline (point)) - (setq tem (buffer-substring start (- end 2))) - (let ((range (news-parse-range - (buffer-substring end endofline)))) - (if (assoc tem news-group-article-assoc) - (message "You are subscribed twice to %s; I ignore second" - tem) - (setq temp-user-groups (cons tem temp-user-groups) - news-group-article-assoc - (cons (list tem (list (car range) - (cdr range) - (cdr range))) - news-group-article-assoc))))) - (kill-buffer newsrcbuf))) - (setq temp-user-groups (nreverse temp-user-groups)) - (message "Prefrobnicating...") - (switch-to-buffer news-buffer) - (setq news-user-group-list temp-user-groups) - (while (and temp-user-groups - (not (news-read-files-into-buffer - (car temp-user-groups) nil))) - (setq temp-user-groups (cdr temp-user-groups))) - (if (null temp-user-groups) - (message "No news is good news.") - (message "")))) - -(defun news-list-news-groups () - "Display all the news groups to which you belong." - (interactive) - (with-output-to-temp-buffer "*Newsgroups*" - (with-current-buffer standard-output - (insert - "News Group Msg No. News Group Msg No.\n") - (insert - "------------------------- -------------------------\n") - (let ((temp news-user-group-list) - (flag nil)) - (while temp - (let ((item (assoc (car temp) news-group-article-assoc))) - (insert (car item)) - (indent-to (if flag 52 20)) - (insert (int-to-string (news-cadr (news-cadr item)))) - (if flag - (insert "\n") - (indent-to 33)) - (setq temp (cdr temp) flag (not flag)))))))) - -;; Mode line hack -(defun news-set-mode-line () - "Set mode line string to something useful." - (setq mode-line-process - (concat " " - (if (integerp news-current-message-number) - (int-to-string news-current-message-number) - "??") - "/" - (if (integerp news-current-group-end) - (int-to-string news-current-group-end) - news-current-group-end))) - (setq mode-line-buffer-identification - (concat "NEWS: " - news-current-news-group - ;; Enough spaces to pad group name to 17 positions. - (substring " " - 0 (max 0 (- 17 (length news-current-news-group)))))) - (set-buffer-modified-p t) - (sit-for 0)) - -(defun news-goto-news-group (gp) - "Takes a string and goes to that news group." - (interactive (list (completing-read "NewsGroup: " - news-group-article-assoc))) - (message "Jumping to news group %s..." gp) - (news-select-news-group gp) - (message "Jumping to news group %s... done." gp)) - -(defun news-select-news-group (gp) - (let ((grp (assoc gp news-group-article-assoc))) - (if (null grp) - (error "Group %s not subscribed to" gp) - (progn - (news-update-message-read news-current-news-group - (news-cdar news-point-pdl)) - (news-read-files-into-buffer (car grp) nil) - (news-set-mode-line))))) - -(defun news-goto-message (arg) - "Goes to the article ARG in current newsgroup." - (interactive "p") - (if (null current-prefix-arg) - (setq arg (read-no-blanks-input "Go to article: " ""))) - (news-select-message arg)) - -(defun news-select-message (arg) - (if (stringp arg) (setq arg (string-to-number arg))) - (let ((file (concat news-path - (string-subst-char ?/ ?. news-current-news-group) - "/" arg))) - (if (= arg - (or (news-cadr (memq (news-cdar news-point-pdl) news-list-of-files)) - 0)) - (setcdr (car news-point-pdl) arg)) - (setq news-current-message-number arg) - (if (file-exists-p file) - (let ((buffer-read-only nil)) - (news-read-in-file file) - (news-set-mode-line)) - (news-set-mode-line) - (error "Article %d nonexistent" arg)))) - -(defun news-force-update () - "updates the position of last article read in the current news group" - (interactive) - (setcdr (car news-point-pdl) news-current-message-number) - (message "Updated to %d" news-current-message-number)) - -(defun news-next-message (arg) - "Move ARG messages forward within one newsgroup. -Negative ARG moves backward. -If ARG is 1 or -1, moves to next or previous newsgroup if at end." - (interactive "p") - (let ((no (+ arg news-current-message-number))) - (if (or (< no news-current-group-begin) - (> no news-current-group-end)) - (cond ((= arg 1) - (news-set-current-group-certification) - (news-next-group)) - ((= arg -1) - (news-previous-group)) - (t (error "Article out of range"))) - (let ((plist (news-get-motion-lists - news-current-message-number - news-list-of-files))) - (if (< arg 0) - (news-select-message (nth (1- (- arg)) (car (cdr plist)))) - (news-select-message (nth (1- arg) (car plist)))))))) - -(defun news-previous-message (arg) - "Move ARG messages backward in current newsgroup. -With no arg or arg of 1, move one message -and move to previous newsgroup if at beginning. -A negative ARG means move forward." - (interactive "p") - (news-next-message (- arg))) - -(defun news-move-to-group (arg) - "Given arg move forward or backward to a new newsgroup." - (let ((cg news-current-news-group)) - (let ((plist (news-get-motion-lists cg news-user-group-list)) - ngrp) - (if (< arg 0) - (or (setq ngrp (nth (1- (- arg)) (news-cadr plist))) - (error "No previous news groups")) - (or (setq ngrp (nth arg (car plist))) - (error "No more news groups"))) - (news-select-news-group ngrp)))) - -(defun news-next-group () - "Moves to the next user group." - (interactive) -; (message "Moving to next group...") - (news-move-to-group 0) - (while (null news-list-of-files) - (news-move-to-group 0))) -; (message "Moving to next group... done.") - -(defun news-previous-group () - "Moves to the previous user group." - (interactive) -; (message "Moving to previous group...") - (news-move-to-group -1) - (while (null news-list-of-files) - (news-move-to-group -1))) -; (message "Moving to previous group... done.") - -(defun news-get-motion-lists (arg listy) - "Given a msgnumber/group this will return a list of two lists; -one for moving forward and one for moving backward." - (let ((temp listy) - (result ())) - (catch 'out - (while temp - (if (equal (car temp) arg) - (throw 'out (cons (cdr temp) (list result))) - (setq result (nconc (list (car temp)) result)) - (setq temp (cdr temp))))))) - -;; miscellaneous io routines -(defun news-read-in-file (filename) - (erase-buffer) - (let ((start (point))) - (insert-file-contents filename) - (news-convert-format) - ;; Run each hook that applies to the current newsgroup. - (let ((hooks news-group-hook-alist)) - (while hooks - (goto-char start) - (if (string-match (car (car hooks)) news-group-name) - (funcall (cdr (car hooks)))) - (setq hooks (cdr hooks)))) - (goto-char start) - (forward-line 1) - (if (eobp) - (message "(Empty file?)") - (goto-char start)))) - -(defun news-convert-format () - (save-excursion - (save-restriction - (let* ((start (point)) - (end (condition-case () - (progn (search-forward "\n\n") (point)) - (error nil))) - has-from has-date) - (cond (end - (narrow-to-region start end) - (goto-char start) - (setq has-from (search-forward "\nFrom:" nil t)) - (cond ((and (not has-from) has-date) - (goto-char start) - (search-forward "\nDate:") - (beginning-of-line) - (kill-line) (kill-line))) - (news-delete-headers start) - (goto-char start))))))) - -(defun news-show-all-headers () - "Redisplay current news item with all original headers" - (interactive) - (let (news-ignored-headers - (buffer-read-only ())) - (erase-buffer) - (news-set-mode-line) - (news-read-in-file - (concat news-path - (string-subst-char ?/ ?. news-current-news-group) - "/" (int-to-string news-current-message-number))))) - -(defun news-delete-headers (pos) - (goto-char pos) - (and (stringp news-ignored-headers) - (while (re-search-forward news-ignored-headers nil t) - (beginning-of-line) - (delete-region (point) - (progn (re-search-forward "\n[^ \t]") - (forward-char -1) - (point)))))) - -(defun news-exit () - "Quit news reading session and update the .newsrc file." - (interactive) - (if (y-or-n-p "Do you really wanna quit reading news ? ") - (progn (message "Updating %s..." news-startup-file) - (news-update-newsrc-file) - (news-write-certifications) - (message "Updating %s... done" news-startup-file) - (message "Now do some real work") - (quit-window) - (switch-to-buffer news-buffer-save) - (setq news-user-group-list ())) - (message ""))) - -(defun news-update-newsrc-file () - "Updates the .newsrc file in the users home dir." - (let ((newsrcbuf (find-file-noselect - (substitute-in-file-name news-startup-file))) - (tem news-user-group-list) - group) - (save-excursion - (if (not (null news-current-news-group)) - (news-update-message-read news-current-news-group - (news-cdar news-point-pdl))) - (set-buffer newsrcbuf) - (while tem - (setq group (assoc (car tem) news-group-article-assoc)) - (if (= (news-cadr (news-cadr group)) (news-caddr (news-cadr group))) - nil - (goto-char 0) - (if (search-forward (concat (car group) ": ") nil t) - (kill-line nil) - (insert (car group) ": \n") (backward-char 1)) - (insert (int-to-string (car (news-cadr group))) "-" - (int-to-string (news-cadr (news-cadr group))))) - (setq tem (cdr tem))) - (while news-unsubscribe-groups - (setq group (assoc (car news-unsubscribe-groups) - news-group-article-assoc)) - (goto-char 0) - (if (search-forward (concat (car group) ": ") nil t) - (progn - (backward-char 2) - (kill-line nil) - (insert "! " (int-to-string (car (news-cadr group))) - "-" (int-to-string (news-cadr (news-cadr group)))))) - (setq news-unsubscribe-groups (cdr news-unsubscribe-groups))) - (save-buffer) - (kill-buffer (current-buffer))))) - - -(defun news-unsubscribe-group (group) - "Removes you from newgroup GROUP." - (interactive (list (completing-read "Unsubscribe from group: " - news-group-article-assoc))) - (news-unsubscribe-internal group)) - -(defun news-unsubscribe-current-group () - "Removes you from the newsgroup you are now reading." - (interactive) - (if (y-or-n-p "Do you really want to unsubscribe from this group ? ") - (news-unsubscribe-internal news-current-news-group))) - -(defun news-unsubscribe-internal (group) - (let ((tem (assoc group news-group-article-assoc))) - (if tem - (progn - (setq news-unsubscribe-groups (cons group news-unsubscribe-groups)) - (news-update-message-read group (news-cdar news-point-pdl)) - (if (equal group news-current-news-group) - (news-next-group)) - (message "")) - (error "Not subscribed to group: %s" group)))) - -(defun news-save-item-in-file (file) - "Save the current article that is being read by appending to a file." - (interactive "FSave item in file: ") - (append-to-file (point-min) (point-max) file)) - -(defun news-get-pruned-list-of-files (gp-list end-file-no) - "Given a news group it finds all files in the news group. -The arg must be in slashified format. -Using ls was found to be too slow in a previous version." - (let - ((answer - (and - (not (and end-file-no - (equal (news-set-current-certifiable) - (news-group-certification gp-list)) - (setq news-list-of-files nil - news-list-of-files-possibly-bogus t))) - (let* ((file-directory (concat news-path - (string-subst-char ?/ ?. gp-list))) - tem - (last-winner - (and end-file-no - (news-wins file-directory end-file-no) - (news-find-first-or-last file-directory end-file-no 1)))) - (setq news-list-of-files-possibly-bogus t news-list-of-files nil) - (if last-winner - (progn - (setq news-list-of-files-possibly-bogus t - news-current-group-end last-winner) - (while (> last-winner end-file-no) - (news-push last-winner news-list-of-files) - (setq last-winner (1- last-winner))) - news-list-of-files) - (if (or (not (file-directory-p file-directory)) - (not (file-readable-p file-directory))) - nil - (setq news-list-of-files - (condition-case error - (directory-files file-directory) - (file-error - (if (string= (nth 2 error) "permission denied") - (message "Newsgroup %s is read-protected" - gp-list) - (signal 'file-error (cdr error))) - nil))) - (setq tem news-list-of-files) - (while tem - (if (or (not (string-match "^[0-9]*$" (car tem))) - ;; don't get confused by directories that look like numbers - (file-directory-p - (concat file-directory "/" (car tem))) - (<= (string-to-number (car tem)) end-file-no)) - (setq news-list-of-files - (delq (car tem) news-list-of-files))) - (setq tem (cdr tem))) - (if (null news-list-of-files) - (progn (setq news-current-group-end 0) - nil) - (setq news-list-of-files - (mapcar 'string-to-number news-list-of-files)) - (setq news-list-of-files (sort news-list-of-files '<)) - (setq news-current-group-end - (elt news-list-of-files - (1- (length news-list-of-files)))) - news-list-of-files))))))) - (or answer (progn (news-set-current-group-certification) nil)))) - -(defun news-read-files-into-buffer (group reversep) - (let* ((files-start-end (news-cadr (assoc group news-group-article-assoc))) - (start-file-no (car files-start-end)) - (end-file-no (news-cadr files-start-end)) - (buffer-read-only nil)) - (setq news-current-news-group group) - (setq news-current-message-number nil) - (setq news-current-group-end nil) - (news-set-mode-line) - (news-get-pruned-list-of-files group end-file-no) - (news-set-mode-line) - ;; @@ should be a lot smarter than this if we have to move - ;; @@ around correctly. - (setq news-point-pdl (list (cons (car files-start-end) - (news-cadr files-start-end)))) - (if (null news-list-of-files) - (progn (erase-buffer) - (setq news-current-group-end end-file-no) - (setq news-current-group-begin end-file-no) - (setq news-current-message-number end-file-no) - (news-set-mode-line) -; (message "No new articles in " group " group.") - nil) - (setq news-current-group-begin (car news-list-of-files)) - (if reversep - (setq news-current-message-number news-current-group-end) - (if (> (car news-list-of-files) end-file-no) - (setcdr (car news-point-pdl) (car news-list-of-files))) - (setq news-current-message-number news-current-group-begin)) - (news-set-message-counters) - (news-set-mode-line) - (news-read-in-file (concat news-path - (string-subst-char ?/ ?. group) - "/" - (int-to-string - news-current-message-number))) - (news-set-message-counters) - (news-set-mode-line) - t))) - -(defun news-add-news-group (gp) - "Resubscribe to or add a USENET news group named GROUP (a string)." -; @@ (completing-read ...) -; @@ could be based on news library file ../active (slightly fascist) -; @@ or (expensive to compute) all directories under the news spool directory - (interactive "sAdd news group: ") - (let ((file-dir (concat news-path (string-subst-char ?/ ?. gp)))) - (save-excursion - (if (null (assoc gp news-group-article-assoc)) - (let ((newsrcbuf (find-file-noselect - (substitute-in-file-name news-startup-file)))) - (if (file-directory-p file-dir) - (progn - (switch-to-buffer newsrcbuf) - (goto-char 0) - (if (search-forward (concat gp "! ") nil t) - (progn - (message "Re-subscribing to group %s." gp) - ;;@@ news-unsubscribe-groups isn't being used - ;;(setq news-unsubscribe-groups - ;; (delq gp news-unsubscribe-groups)) - (backward-char 2) - (delete-char 1) - (insert ":")) - (progn - (message - "Added %s to your list of newsgroups." gp) - (goto-char (point-max)) - (insert gp ": 1-1\n"))) - (search-backward gp nil t) - (let (start end endofline tem) - (search-forward ": " nil t) - (setq end (point)) - (beginning-of-line) - (setq start (point)) - (end-of-line) - (setq endofline (point)) - (setq tem (buffer-substring start (- end 2))) - (let ((range (news-parse-range - (buffer-substring end endofline)))) - (setq news-group-article-assoc - (cons (list tem (list (car range) - (cdr range) - (cdr range))) - news-group-article-assoc)))) - (save-buffer) - (kill-buffer (current-buffer))) - (message "Newsgroup %s doesn't exist." gp))) - (message "Already subscribed to group %s." gp))))) - -(defun news-make-link-to-message (number newname) - "Forges a link to an rnews message numbered number (current if no arg) -Good for hanging on to a message that might or might not be -automatically deleted." - (interactive "P -FName to link to message: ") - (add-name-to-file - (concat news-path - (string-subst-char ?/ ?. news-current-news-group) - "/" (if number - (prefix-numeric-value number) - news-current-message-number)) - newname)) - -;;; caesar-region written by phr@gnu.org Nov 86 -;;; modified by tower@gnu.org Nov 86 -(defun caesar-region (&optional n) - "Caesar rotation of region by N, default 13, for decrypting netnews." - (interactive (if current-prefix-arg ; Was there a prefix arg? - (list (prefix-numeric-value current-prefix-arg)) - (list nil))) - (cond ((not (numberp n)) (setq n 13)) - (t (setq n (mod n 26)))) ;canonicalize N - (if (not (zerop n)) ; no action needed for a rot of 0 - (progn - (if (or (not (boundp 'caesar-translate-table)) - (/= (aref caesar-translate-table ?a) (+ ?a n))) - (let ((i 0) (lower "abcdefghijklmnopqrstuvwxyz") upper) - (message "Building caesar-translate-table...") - (setq caesar-translate-table (make-vector 256 0)) - (while (< i 256) - (aset caesar-translate-table i i) - (setq i (1+ i))) - (setq lower (concat lower lower) upper (upcase lower) i 0) - (while (< i 26) - (aset caesar-translate-table (+ ?a i) (aref lower (+ i n))) - (aset caesar-translate-table (+ ?A i) (aref upper (+ i n))) - (setq i (1+ i))) - (message "Building caesar-translate-table... done"))) - (let ((from (region-beginning)) - (to (region-end)) - (i 0) str len) - (setq str (buffer-substring from to)) - (setq len (length str)) - (while (< i len) - (aset str i (aref caesar-translate-table (aref str i))) - (setq i (1+ i))) - (goto-char from) - (kill-region from to) - (insert str))))) - -;;; news-caesar-buffer-body written by paul@media-lab.mit.edu Wed Oct 1, 1986 -;;; hacked further by tower@gnu.org -(defun news-caesar-buffer-body (&optional rotnum) - "Caesar rotates all letters in the current buffer by 13 places. -Used to encode/decode possibly offensive messages (commonly in net.jokes). -With prefix arg, specifies the number of places to rotate each letter forward. -Mail and USENET news headers are not rotated." - (interactive (if current-prefix-arg ; Was there a prefix arg? - (list (prefix-numeric-value current-prefix-arg)) - (list nil))) - (save-excursion - (let ((buffer-status buffer-read-only)) - (setq buffer-read-only nil) - ;; setup the region - (set-mark (if (equal major-mode 'news-mode) - (progn (goto-char (point-min)) - (search-forward "\n\n" nil t)) - (mail-text-start))) - (goto-char (point-max)) - (caesar-region rotnum) - (setq buffer-read-only buffer-status)))) - -(provide 'rnews) - -;; arch-tag: c032a20b-cafb-466c-b3fa-5be404a18f8c -;;; rnews.el ends here === removed file 'lisp/obsolete/rnewspost.el' --- lisp/obsolete/rnewspost.el 2010-10-05 04:14:08 +0000 +++ lisp/obsolete/rnewspost.el 1970-01-01 00:00:00 +0000 @@ -1,447 +0,0 @@ -;;; rnewspost.el --- USENET news poster/mailer for GNU Emacs - -;; Copyright (C) 1985, 1986, 1987, 1995, 2001, 2002, 2003, 2004, 2005, -;; 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. - -;; Maintainer: FSF -;; Keywords: mail, news - -;; This file is part of GNU Emacs. - -;; GNU Emacs is free software: you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; GNU Emacs is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with GNU Emacs. If not, see . - -;;; Commentary: - -;; This file has been obsolete since Emacs 21.1. - -;;; Change Log: - -;; moved posting and mail code from rnews.el -;; tower@gnu.org Wed Oct 29 1986 -;; brought posting code almost up to the revision of RFC 850 for News 2.11 -;; - couldn't see handling the special meaning of the Keyword: poster -;; - not worth the code space to support the old A news Title: (which -;; Subject: replaced) and Article-I.D.: (which Message-ID: replaced) -;; tower@gnu.org Nov 86 -;; changed C-c C-r key-binding due to rename of news-caesar-buffer-body -;; tower@gnu.org 21 Nov 86 -;; added (require 'rnews) tower@gnu.org 22 Apr 87 -;; restricted call of news-show-all-headers in news-post-news & news-reply -;; tower@gnu.org 28 Apr 87 -;; commented out Posting-Front-End to save USENET bytes tower@gnu.org Jul 31 87 -;; commented out -n and -t args in news-inews tower@gnu.org 15 Oct 87 - -;Now in paths.el. -;(defvar news-inews-program "inews" -; "Function to post news.") - -;; Replying and posting news items are done by these functions. -;; imported from rmail and modified to work with rnews ... -;; Mon Mar 25,1985 at 03:07:04 ads@mit-hermes. -;; this is done so that rnews can operate independently from rmail.el and -;; sendmail and doesn't have to autoload these functions. -;; -;;; >> Nuked by Mly to autoload those functions again, as the duplication of -;;; >> code was making maintenance too difficult. - -;;; Code: - -(require 'sendmail) -(require 'rnews) - -(defvar mail-reply-buffer) - -(defvar news-reply-mode-map () "Mode map used by news-reply.") - -(or news-reply-mode-map - (progn - (setq news-reply-mode-map (make-keymap)) - (define-key news-reply-mode-map "\C-c\C-f\C-d" 'news-reply-distribution) - (define-key news-reply-mode-map "\C-c\C-f\C-k" 'news-reply-keywords) - (define-key news-reply-mode-map "\C-c\C-f\C-n" 'news-reply-newsgroups) - (define-key news-reply-mode-map "\C-c\C-f\C-f" 'news-reply-followup-to) - (define-key news-reply-mode-map "\C-c\C-f\C-s" 'mail-subject) - (define-key news-reply-mode-map "\C-c\C-f\C-a" 'news-reply-summary) - (define-key news-reply-mode-map "\C-c\C-t" 'mail-text) - (define-key news-reply-mode-map "\C-c\C-r" 'news-caesar-buffer-body) - (define-key news-reply-mode-map "\C-c\C-w" 'news-reply-signature) - (define-key news-reply-mode-map "\C-c\C-y" 'news-reply-yank-original) - (define-key news-reply-mode-map "\C-c\C-q" 'mail-fill-yanked-message) - (define-key news-reply-mode-map "\C-c\C-c" 'news-inews) - (define-key news-reply-mode-map "\C-c\C-s" 'news-inews) - (define-key news-reply-mode-map [menu-bar] (make-sparse-keymap)) - (define-key news-reply-mode-map [menu-bar fields] - (cons "Fields" (make-sparse-keymap "Fields"))) - (define-key news-reply-mode-map [menu-bar fields news-reply-distribution] - '("Distribution" . news-reply-distribution)) - (define-key news-reply-mode-map [menu-bar fields news-reply-keywords] - '("Keywords" . news-reply-keywords)) - (define-key news-reply-mode-map [menu-bar fields news-reply-newsgroups] - '("Newsgroups" . news-reply-newsgroups)) - (define-key news-reply-mode-map [menu-bar fields news-reply-followup-to] - '("Followup-to" . news-reply-followup-to)) - (define-key news-reply-mode-map [menu-bar fields mail-subject] - '("Subject" . mail-subject)) - (define-key news-reply-mode-map [menu-bar fields news-reply-summary] - '("Summary" . news-reply-summary)) - (define-key news-reply-mode-map [menu-bar fields mail-text] - '("Text" . mail-text)) - (define-key news-reply-mode-map [menu-bar news] - (cons "News" (make-sparse-keymap "News"))) - (define-key news-reply-mode-map [menu-bar news news-caesar-buffer-body] - '("Rot13" . news-caesar-buffer-body)) - (define-key news-reply-mode-map [menu-bar news news-reply-yank-original] - '("Yank Original" . news-reply-yank-original)) - (define-key news-reply-mode-map [menu-bar news mail-fill-yanked-message] - '("Fill Yanked Messages" . mail-fill-yanked-message)) - (define-key news-reply-mode-map [menu-bar news news-inews] - '("Send" . news-inews)))) - -(defun news-reply-mode () - "Major mode for editing news to be posted on USENET. -First-time posters are asked to please read the articles in newsgroup: - news.announce.newusers . -Like Text Mode but with these additional commands: - -C-c C-s news-inews (post the message) C-c C-c news-inews -C-c C-f move to a header field (and create it if there isn't): - C-c C-f C-n move to Newsgroups: C-c C-f C-s move to Subj: - C-c C-f C-f move to Followup-To: C-c C-f C-k move to Keywords: - C-c C-f C-d move to Distribution: C-c C-f C-a move to Summary: -C-c C-y news-reply-yank-original (insert current message, in NEWS). -C-c C-q mail-fill-yanked-message (fill what was yanked). -C-c C-r caesar rotate all letters by 13 places in the article's body (rot13)." - (interactive) - (kill-all-local-variables) - (make-local-variable 'mail-reply-buffer) - (setq mail-reply-buffer nil) - (set-syntax-table text-mode-syntax-table) - (use-local-map news-reply-mode-map) - (setq local-abbrev-table text-mode-abbrev-table) - (setq major-mode 'news-reply-mode) - (setq mode-name "News Reply") - (make-local-variable 'paragraph-separate) - (make-local-variable 'paragraph-start) - (run-mode-hooks 'text-mode-hook 'news-reply-mode-hook)) - -(defvar news-reply-yank-from "" - "Save `From:' field for `news-reply-yank-original'.") - -(defvar news-reply-yank-message-id "" - "Save `Message-Id:' field for `news-reply-yank-original'.") - -(defun news-reply-yank-original (arg) - "Insert the message being replied to, if any (in Mail mode). -Puts point before the text and mark after. -Indents each nonblank line ARG spaces (default 3). -Just \\[universal-argument] as argument means don't indent -and don't delete any header fields." - (interactive "P") - (mail-yank-original arg) - (exchange-point-and-mark) - (run-hooks 'news-reply-header-hook)) - -(defvar news-reply-header-hook - (lambda () - (insert "In article " news-reply-yank-message-id - " " news-reply-yank-from " writes:\n\n")) - "Hook for inserting a header at the top of a yanked message.") - -(defun news-reply-newsgroups () - "Move point to end of `Newsgroups:' field. -RFC 850 constrains the `Newsgroups:' field to be a comma-separated list -of valid newsgroup names at your site. For example, - Newsgroups: news.misc,comp.misc,rec.misc" - (interactive) - (expand-abbrev) - (goto-char (point-min)) - (mail-position-on-field "Newsgroups")) - -(defun news-reply-followup-to () - "Move point to end of `Followup-To:' field. Create the field if none. -One usually requests followups to only one newsgroup. -RFC 850 constrains the `Followup-To:' field to be a comma-separated list -of valid newsgroups names at your site, and it must be a subset of the -`Newsgroups:' field. For example: - Newsgroups: news.misc,comp.misc,rec.misc,misc.misc,soc.misc - Followup-To: news.misc,comp.misc,rec.misc" - (interactive) - (expand-abbrev) - (or (mail-position-on-field "Followup-To" t) - (progn (mail-position-on-field "newsgroups") - (insert "\nFollowup-To: "))) - ;; @@ could do a completing read based on the Newsgroups: field to - ;; @@ fill in the Followup-To: field -) - -(defun news-reply-distribution () - "Move point to end of `Distribution:' optional field. -Create the field if none. Without this field the posting goes to all of -USENET. The field is used to restrict the posting to parts of USENET." - (interactive) - (expand-abbrev) - (mail-position-on-field "Distribution") - ;; @@could do a completing read based on the news library file: - ;; @@ ../distributions to fill in the field. - ) - -(defun news-reply-keywords () - "Move point to end of `Keywords:' optional field. Create the field if none. -Used as an aid to the news reader, it can contain a few, well selected keywords -identifying the message." - (interactive) - (expand-abbrev) - (mail-position-on-field "Keywords")) - -(defun news-reply-summary () - "Move point to end of `Summary:' optional field. Create the field if none. -Used as an aid to the news reader, it can contain a succinct -summary (abstract) of the message." - (interactive) - (expand-abbrev) - (mail-position-on-field "Summary")) - -(defun news-reply-signature () - "The inews program appends `~/.signature' automatically." - (interactive) - (message "Posting news will append your signature automatically.")) - -(defun news-setup (to subject in-reply-to newsgroups replybuffer) - "Set up the news reply or posting buffer with the proper headers and mode." - (setq mail-reply-buffer replybuffer) - (let ((mail-setup-hook nil) - ;; Avoid inserting a signature. - (mail-signature)) - (if (null to) - ;; this hack is needed so that inews wont be confused by - ;; the fcc: and bcc: fields - (let ((mail-self-blind nil) - (mail-archive-file-name nil)) - (mail-setup to subject in-reply-to nil replybuffer nil) - (beginning-of-line) - (delete-region (point) (progn (forward-line 1) (point))) - (goto-char (point-max))) - (mail-setup to subject in-reply-to nil replybuffer nil)) - ;;;(mail-position-on-field "Posting-Front-End") - ;;;(insert (emacs-version)) - (goto-char (point-max)) - (if (let ((case-fold-search t)) - (re-search-backward "^Subject:" (point-min) t)) - (progn (beginning-of-line) - (insert "Newsgroups: " (or newsgroups "") "\n") - (if (not newsgroups) - (backward-char 1) - (goto-char (point-max))))) - (let (actual-header-separator) - (rfc822-goto-eoh) - (setq actual-header-separator (buffer-substring - (point) - (save-excursion (end-of-line) (point)))) - (setq paragraph-start - (concat "^" actual-header-separator "$\\|" paragraph-start)) - (setq paragraph-separate - (concat "^" actual-header-separator "$\\|" paragraph-separate))) - (run-hooks 'news-setup-hook))) - -(defun news-inews () - "Send a news message using inews." - (interactive) - (let* (newsgroups subject - (case-fold-search nil)) - (save-excursion - (save-restriction - (narrow-to-region (point-min) (mail-header-end)) - (setq newsgroups (mail-fetch-field "newsgroups") - subject (mail-fetch-field "subject"))) - (widen) - (goto-char (point-min)) - (run-hooks 'news-inews-hook) - (mail-sendmail-undelimit-header) - (goto-char (point-max)) - ;; require a newline at the end for inews to append .signature to - (or (= (preceding-char) ?\n) - (insert ?\n)) - (message "Posting to USENET...") - (unwind-protect - (if (not (eq 0 - (call-process-region (point-min) (point-max) - news-inews-program nil 0 nil - "-h"))) ; take all header lines! - ;@@ setting of subject and newsgroups still needed? - ;"-t" subject - ;"-n" newsgroups - (error "Posting to USENET failed") - (message "Posting to USENET... done")) - (mail-sendmail-delimit-header) - (set-buffer-modified-p nil))) - (bury-buffer))) - -;@@ shares some code with news-reply and news-post-news -(defun news-mail-reply () - "Mail a reply to the author of the current article. -While composing the reply, use \\[news-reply-yank-original] to yank the -original message into it." - (interactive) - (let (from cc subject date to reply-to message-id - (buffer (current-buffer))) - (save-restriction - (narrow-to-region (point-min) (progn (goto-char (point-min)) - (search-forward "\n\n") - (1- (point)))) - (setq from (mail-fetch-field "from") - subject (mail-fetch-field "subject") - reply-to (mail-fetch-field "reply-to") - date (mail-fetch-field "date") - message-id (mail-fetch-field "message-id"))) - (setq to from) - (pop-to-buffer "*mail*") - (mail nil - (if reply-to reply-to to) - subject - (let ((stop-pos (string-match " *at \\| *@ \\| *(\\| *<" from))) - (concat (if stop-pos (substring from 0 stop-pos) from) - "'s message " - (if message-id - (concat message-id " of ") - "of ") - date)) - nil - buffer))) - -;@@ the guts of news-reply and news-post-news should be combined. -tower -(defun news-reply () - "Compose and post a reply (aka a followup) to the current article on USENET. -While composing the followup, use \\[news-reply-yank-original] to yank the -original message into it." - (interactive) - (if (y-or-n-p "Are you sure you want to followup to all of USENET? ") - (let (from cc subject date to followup-to newsgroups message-of - references distribution message-id - (buffer (current-buffer))) - (save-restriction - (and (not (= 0 (buffer-size))) ;@@real problem is non-existence of - ;@@ of article file - (equal major-mode 'news-mode) ;@@ if rmail-mode, - ;@@ should show full headers - (progn - (news-show-all-headers) ;@@ should save/restore header state, - ;@@ but rnews.el lacks support - (narrow-to-region (point-min) (progn (goto-char (point-min)) - (search-forward "\n\n") - (- (point) 1))))) - (setq from (mail-fetch-field "from") - news-reply-yank-from from - ;; @@ not handling old Title: field - subject (mail-fetch-field "subject") - date (mail-fetch-field "date") - followup-to (mail-fetch-field "followup-to") - newsgroups (or followup-to - (mail-fetch-field "newsgroups")) - references (mail-fetch-field "references") - ;; @@ not handling old Article-I.D.: field - distribution (mail-fetch-field "distribution") - message-id (mail-fetch-field "message-id") - news-reply-yank-message-id message-id) - (pop-to-buffer "*post-news*") - (news-reply-mode) - (if (and (buffer-modified-p) - (not - (y-or-n-p "Unsent article being composed; erase it? "))) - () - (progn - (erase-buffer) - (and subject - (progn (if (string-match "\\`Re: " subject) - (while (string-match "\\`Re: " subject) - (setq subject (substring subject 4)))) - (setq subject (concat "Re: " subject)))) - (and from - (progn - (let ((stop-pos - (string-match " *at \\| *@ \\| *(\\| *<" from))) - (setq message-of - (concat - (if stop-pos (substring from 0 stop-pos) from) - "'s message " - (if message-id - (concat message-id " of ") - "of ") - date))))) - (news-setup - nil - subject - message-of - newsgroups - buffer) - (if followup-to - (progn (news-reply-followup-to) - (insert followup-to))) - (if distribution - (progn - (mail-position-on-field "Distribution") - (insert distribution))) - (mail-position-on-field "References") - (if references - (insert references)) - (if (and references message-id) - (insert " ")) - (if message-id - (insert message-id)) - (goto-char (point-max)))))) - (message ""))) - -;@@ the guts of news-reply and news-post-news should be combined. -tower -;;;###autoload -(defun news-post-news (&optional noquery) - "Begin editing a new USENET news article to be posted. -Type \\[describe-mode] once editing the article to get a list of commands. -If NOQUERY is non-nil, we do not query before doing the work." - (interactive) - (if (or noquery - (y-or-n-p "Are you sure you want to post to all of USENET? ")) - (let ((buffer (current-buffer))) - (save-restriction - (and (not (= 0 (buffer-size))) ;@@real problem is non-existence of - ;@@ of article file - (equal major-mode 'news-mode) ;@@ if rmail-mode, - ;@@ should show full headers - (progn - (news-show-all-headers) ;@@ should save/restore header state, - ;@@ but rnews.el lacks support - (narrow-to-region (point-min) (progn (goto-char (point-min)) - (search-forward "\n\n") - (- (point) 1))))) - (setq news-reply-yank-from (mail-fetch-field "from") - ;; @@ not handling old Article-I.D.: field - news-reply-yank-message-id (mail-fetch-field "message-id"))) - (pop-to-buffer "*post-news*") - (news-reply-mode) - (if (and (buffer-modified-p) - (not (y-or-n-p "Unsent article being composed; erase it? "))) - () ;@@ not saving point from last time - (progn (erase-buffer) - (news-setup () () () () buffer)))) - (message ""))) - -(defun news-mail-other-window () - "Send mail in another window. -While composing the message, use \\[news-reply-yank-original] to yank the -original message into it." - (interactive) - (mail-other-window nil nil nil nil nil (current-buffer))) - -(provide 'rnewspost) - -;; arch-tag: 18f7b2af-cf9a-49e4-878b-71eb49913e00 -;;; rnewspost.el ends here ------------------------------------------------------------ revno: 101797 committer: Glenn Morris branch nick: trunk timestamp: Mon 2010-10-04 21:14:08 -0700 message: Fix rnewspost.el comment typo. diff: === modified file 'lisp/obsolete/rnewspost.el' --- lisp/obsolete/rnewspost.el 2010-01-13 08:35:10 +0000 +++ lisp/obsolete/rnewspost.el 2010-10-05 04:14:08 +0000 @@ -23,7 +23,7 @@ ;;; Commentary: -;; This file has been obsolete since Emacs 22.1. +;; This file has been obsolete since Emacs 21.1. ;;; Change Log: ------------------------------------------------------------ revno: 101796 committer: Katsumi Yamaoka branch nick: trunk timestamp: Tue 2010-10-05 03:48:30 +0000 message: gnus-html.el (gnus-html-schedule-image-fetching): Work for XEmacs. diff: === modified file 'lisp/gnus/ChangeLog' --- lisp/gnus/ChangeLog 2010-10-05 02:08:37 +0000 +++ lisp/gnus/ChangeLog 2010-10-05 03:48:30 +0000 @@ -1,5 +1,8 @@ 2010-10-05 Katsumi Yamaoka + * gnus-html.el: Don't require help-fns under XEmacs. + (gnus-html-schedule-image-fetching): Work for XEmacs. + * mm-decode.el (mm-shr): Decode contents by charset. 2010-10-04 Lars Magne Ingebrigtsen === modified file 'lisp/gnus/gnus-html.el' --- lisp/gnus/gnus-html.el 2010-10-04 10:16:57 +0000 +++ lisp/gnus/gnus-html.el 2010-10-05 03:48:30 +0000 @@ -37,7 +37,7 @@ (require 'url-cache) (require 'xml) (require 'browse-url) -(require 'help-fns) +(eval-and-compile (unless (featurep 'xemacs) (require 'help-fns))) (defcustom gnus-html-image-cache-ttl (days-to-time 7) "Time used to determine if we should use images from the cache." @@ -367,7 +367,10 @@ (let ((args (list (car image) 'gnus-html-image-fetched (list buffer image)))) - (when (> (length (help-function-arglist 'url-retrieve)) 4) + (when (> (length (if (featurep 'xemacs) + (split-string (function-arglist 'url-retrieve)) + (help-function-arglist 'url-retrieve))) + 4) (setq args (nconc args (list t)))) (apply #'url-retrieve args))) ------------------------------------------------------------ revno: 101795 committer: Glenn Morris branch nick: trunk timestamp: Mon 2010-10-04 19:40:34 -0700 message: * .dir-locals.el: The Emacs convention is sentence-end-double-space. Remove arch-tag comment. diff: === modified file '.dir-locals.el' --- .dir-locals.el 2010-03-19 09:46:08 +0000 +++ .dir-locals.el 2010-10-05 02:40:34 +0000 @@ -1,4 +1,5 @@ ((nil . ((tab-width . 8) + (sentence-end-double-space . t) (fill-column . 70))) (c-mode . ((c-file-style . "GNU"))) (change-log-mode . ((add-log-time-zone-rule . t) @@ -6,5 +7,3 @@ (bug-reference-url-format . "http://debbugs.gnu.org/%s") (mode . bug-reference))) (diff-mode . ((mode . whitespace)))) - -;; arch-tag: fb93c160-e9fe-4184-aad1-e4f5daa11cbd === modified file 'ChangeLog' --- ChangeLog 2010-10-03 15:39:21 +0000 +++ ChangeLog 2010-10-05 02:40:34 +0000 @@ -1,3 +1,7 @@ +2010-10-05 Glenn Morris + + * .dir-locals.el: The Emacs convention is sentence-end-double-space. + 2010-10-03 Dan Nicolaescu * configure.in (NO_INLINE, noinline): Move here from src/xterm.c. ------------------------------------------------------------ revno: 101794 committer: Katsumi Yamaoka branch nick: trunk timestamp: Tue 2010-10-05 02:08:37 +0000 message: mm-decode.el (mm-shr): Decode contents by charset. diff: === modified file 'lisp/gnus/ChangeLog' --- lisp/gnus/ChangeLog 2010-10-05 01:23:11 +0000 +++ lisp/gnus/ChangeLog 2010-10-05 02:08:37 +0000 @@ -1,3 +1,7 @@ +2010-10-05 Katsumi Yamaoka + + * mm-decode.el (mm-shr): Decode contents by charset. + 2010-10-04 Lars Magne Ingebrigtsen * shr.el (shr-tag-blockquote): Ensure paragraph after quote, too. === modified file 'lisp/gnus/mm-decode.el' --- lisp/gnus/mm-decode.el 2010-10-04 00:17:16 +0000 +++ lisp/gnus/mm-decode.el 2010-10-05 02:08:37 +0000 @@ -1679,14 +1679,27 @@ (and (eq (mm-body-7-or-8) '7bit) (not (mm-long-lines-p 76)))))) +(declare-function libxml-parse-html-region "xml.c" + (start end &optional base-url)) +(declare-function shr-insert-document "shr" (dom)) + (defun mm-shr (handle) - (let ((article-buffer (current-buffer))) + (let ((article-buffer (current-buffer)) + charset) (unless handle (setq handle (mm-dissect-buffer t))) + (setq charset (mail-content-type-get (mm-handle-type handle) 'charset)) (save-restriction (narrow-to-region (point) (point)) (shr-insert-document (mm-with-part handle + (when (and charset + (setq charset (mm-charset-to-coding-system charset)) + (not (eq charset 'ascii))) + (insert (prog1 + (mm-decode-coding-string (buffer-string) charset) + (erase-buffer) + (mm-enable-multibyte)))) (libxml-parse-html-region (point-min) (point-max))))))) (provide 'mm-decode) ------------------------------------------------------------ revno: 101793 committer: Katsumi Yamaoka branch nick: trunk timestamp: Tue 2010-10-05 01:23:11 +0000 message: shr.el: Revert last change. diff: === modified file 'lisp/gnus/ChangeLog' --- lisp/gnus/ChangeLog 2010-10-05 00:44:05 +0000 +++ lisp/gnus/ChangeLog 2010-10-05 01:23:11 +0000 @@ -1,9 +1,3 @@ -2010-10-05 Katsumi Yamaoka - - * shr.el (shr-encode-url-chars): New function, that's an alias to - browse-url-url-encode-chars or a copy of it. - (shr-tag-img): Use it. - 2010-10-04 Lars Magne Ingebrigtsen * shr.el (shr-tag-blockquote): Ensure paragraph after quote, too. === modified file 'lisp/gnus/shr.el' --- lisp/gnus/shr.el 2010-10-05 00:44:05 +0000 +++ lisp/gnus/shr.el 2010-10-05 01:23:11 +0000 @@ -191,25 +191,6 @@ (copy-region-as-kill (point-min) (point-max)) (message "Copied %s" url)))))) -(eval-and-compile - (defalias 'shr-encode-url-chars - ;; Neither Emacs 22 nor XEmacs provides this function. - (if (fboundp 'browse-url-url-encode-chars) - 'browse-url-url-encode-chars - (lambda (text chars) - "URL-encode the chars in TEXT that match CHARS. -CHARS is a regexp-like character alternative (e.g., \"[)$]\")." - (let ((encoded-text (copy-sequence text)) - (s 0)) - (while (setq s (string-match chars encoded-text s)) - (setq encoded-text - (replace-match (format "%%%x" - (string-to-char - (match-string 0 encoded-text))) - t t encoded-text) - s (1+ s))) - encoded-text))))) - (defun shr-tag-img (cont) (when (and (> (current-column) 0) (not (eq shr-state 'image))) @@ -223,7 +204,7 @@ ((and shr-blocked-images (string-match shr-blocked-images url)) (insert alt)) - ((url-is-cached (shr-encode-url-chars url "[&)$ ]")) + ((url-is-cached (browse-url-url-encode-chars url "[&)$ ]")) (shr-put-image (shr-get-image-data url) (point) alt)) (t (insert alt) ------------------------------------------------------------ revno: 101792 committer: Katsumi Yamaoka branch nick: trunk timestamp: Tue 2010-10-05 00:44:05 +0000 message: shr.el (shr-encode-url-chars): New function. diff: === modified file 'lisp/gnus/ChangeLog' --- lisp/gnus/ChangeLog 2010-10-04 22:26:51 +0000 +++ lisp/gnus/ChangeLog 2010-10-05 00:44:05 +0000 @@ -1,3 +1,9 @@ +2010-10-05 Katsumi Yamaoka + + * shr.el (shr-encode-url-chars): New function, that's an alias to + browse-url-url-encode-chars or a copy of it. + (shr-tag-img): Use it. + 2010-10-04 Lars Magne Ingebrigtsen * shr.el (shr-tag-blockquote): Ensure paragraph after quote, too. === modified file 'lisp/gnus/shr.el' --- lisp/gnus/shr.el 2010-10-04 22:26:51 +0000 +++ lisp/gnus/shr.el 2010-10-05 00:44:05 +0000 @@ -191,6 +191,25 @@ (copy-region-as-kill (point-min) (point-max)) (message "Copied %s" url)))))) +(eval-and-compile + (defalias 'shr-encode-url-chars + ;; Neither Emacs 22 nor XEmacs provides this function. + (if (fboundp 'browse-url-url-encode-chars) + 'browse-url-url-encode-chars + (lambda (text chars) + "URL-encode the chars in TEXT that match CHARS. +CHARS is a regexp-like character alternative (e.g., \"[)$]\")." + (let ((encoded-text (copy-sequence text)) + (s 0)) + (while (setq s (string-match chars encoded-text s)) + (setq encoded-text + (replace-match (format "%%%x" + (string-to-char + (match-string 0 encoded-text))) + t t encoded-text) + s (1+ s))) + encoded-text))))) + (defun shr-tag-img (cont) (when (and (> (current-column) 0) (not (eq shr-state 'image))) @@ -204,7 +223,7 @@ ((and shr-blocked-images (string-match shr-blocked-images url)) (insert alt)) - ((url-is-cached (browse-url-url-encode-chars url "[&)$ ]")) + ((url-is-cached (shr-encode-url-chars url "[&)$ ]")) (shr-put-image (shr-get-image-data url) (point) alt)) (t (insert alt) ------------------------------------------------------------ revno: 101791 author: Gnus developers committer: Katsumi Yamaoka branch nick: trunk timestamp: Mon 2010-10-04 22:26:51 +0000 message: Merge changes made in Gnus trunk. shr.el: Implement table rendering. shr.el (shr-make-table): Tweak table generation. shr.el (shr-make-table): Fix typo. nnimap.el (nnimap-open-connection): Allow tls as a synonym for ssl. gnus-util.el (gnus-emacs-completing-read): Mapcar collection to list, for XEmacs. nnimap.el (nnimap-close-server): Implement. gnus-salt.el: Remove all gnus-carpal stuff -- it's not useful. nnir.el (nnir-run-imap): Remove spurious space in search string. message.el (message-idna-to-ascii-rhs-1): Don't bug out on addresses without @ signs. gnus-sum.el (gnus-widen-article-window): New variable. shr.el (browse-url): Required. shr.el (shr-ensure-paragraph): Don't insert a new newline after empty-ish lines. shr.el (shr-show-alt-text, shr-browse-image): New commands. gravatar.el (gravatar-retrieved): kill buffer when retrieved. shr.el (shr-browse-url, shr-copy-url): New commands. shr.el (shr-render-td): Protect against too-wide text. spam-report.el (spam-report-url-ping-plain): Don't query about killing the process. nnimap.el (nnimap-finish-retrieve-group-infos): Message while waiting for data. shr.el (shr-tag-blockquote): Ensure paragraph after quote, too. mml-smime.el: Fix gnus-completing-read usage. shr.el (shr-get-image-data): Ensure against the cache file missing. nnimap.el (nnimap-open-connection): Give an error if nnimap-stream is unknown. diff: === modified file 'doc/misc/ChangeLog' --- doc/misc/ChangeLog 2010-10-04 00:17:16 +0000 +++ doc/misc/ChangeLog 2010-10-04 22:26:51 +0000 @@ -1,3 +1,7 @@ +2010-10-04 Lars Magne Ingebrigtsen + + * gnus.texi (Misc Article): Document gnus-widen-article-window. + 2010-10-03 Julien Danjou * emacs-mime.texi (Display Customization): Update === modified file 'doc/misc/gnus-news.texi' --- doc/misc/gnus-news.texi 2010-09-26 23:01:31 +0000 +++ doc/misc/gnus-news.texi 2010-10-04 22:26:51 +0000 @@ -356,6 +356,8 @@ @item NoCeM support has been removed. +@item Carpal mode has been removed. + @end itemize @end itemize === modified file 'doc/misc/gnus.texi' --- doc/misc/gnus.texi 2010-10-03 00:33:27 +0000 +++ doc/misc/gnus.texi 2010-10-04 22:26:51 +0000 @@ -797,7 +797,6 @@ * Compilation:: How to speed Gnus up. * Mode Lines:: Displaying information in the mode lines. * Highlighting and Menus:: Making buffers look all nice and cozy. -* Buttons:: Get tendinitis in ten easy steps! * Daemons:: Gnus can do things behind your back. * Undo:: Some actions can be undone. * Predicate Specifiers:: Specifying predicates. @@ -12847,6 +12846,11 @@ (This is the default.) If @code{nil}, each group will have its own article buffer. +@item gnus-widen-article-window +@cindex gnus-widen-article-window +If non-@code{nil}, selecting the article buffer with the @kbd{h} +command will ``widen'' the article window to take the entire frame. + @vindex gnus-article-decode-hook @item gnus-article-decode-hook @cindex @acronym{MIME} @@ -21717,7 +21721,6 @@ * Compilation:: How to speed Gnus up. * Mode Lines:: Displaying information in the mode lines. * Highlighting and Menus:: Making buffers look all nice and cozy. -* Buttons:: Get tendinitis in ten easy steps! * Daemons:: Gnus can do things behind your back. * Undo:: Some actions can be undone. * Predicate Specifiers:: Specifying predicates. @@ -22178,8 +22181,7 @@ buffer should be given. Here's an excerpt of this variable: @lisp -((group (vertical 1.0 (group 1.0 point) - (if gnus-carpal (group-carpal 4)))) +((group (vertical 1.0 (group 1.0 point))) (article (vertical 1.0 (summary 0.25 point) (article 1.0)))) @end lisp @@ -22217,7 +22219,6 @@ @lisp (article (vertical 1.0 (group 4) (summary 0.25 point) - (if gnus-carpal (summary-carpal 4)) (article 1.0))) @end lisp @@ -22228,20 +22229,16 @@ If the @dfn{split} looks like something that can be @code{eval}ed (to be precise---if the @code{car} of the split is a function or a subr), this split will be @code{eval}ed. If the result is non-@code{nil}, it will -be used as a split. This means that there will be three buffers if -@code{gnus-carpal} is @code{nil}, and four buffers if @code{gnus-carpal} -is non-@code{nil}. +be used as a split. Not complicated enough for you? Well, try this on for size: @lisp (article (horizontal 1.0 (vertical 0.5 - (group 1.0) - (gnus-carpal 4)) + (group 1.0)) (vertical 1.0 (summary 0.25 point) - (summary-carpal 4) (article 1.0)))) @end lisp @@ -22618,62 +22615,6 @@ @end table -@node Buttons -@section Buttons -@cindex buttons -@cindex mouse -@cindex click - -Those new-fangled @dfn{mouse} contraptions is very popular with the -young, hep kids who don't want to learn the proper way to do things -these days. Why, I remember way back in the summer of '89, when I was -using Emacs on a Tops 20 system. Three hundred users on one single -machine, and every user was running Simula compilers. Bah! - -Right. - -@vindex gnus-carpal -Well, you can make Gnus display bufferfuls of buttons you can click to -do anything by setting @code{gnus-carpal} to @code{t}. Pretty simple, -really. Tell the chiropractor I sent you. - - -@table @code - -@item gnus-carpal-mode-hook -@vindex gnus-carpal-mode-hook -Hook run in all carpal mode buffers. - -@item gnus-carpal-button-face -@vindex gnus-carpal-button-face -Face used on buttons. - -@item gnus-carpal-header-face -@vindex gnus-carpal-header-face -Face used on carpal buffer headers. - -@item gnus-carpal-group-buffer-buttons -@vindex gnus-carpal-group-buffer-buttons -Buttons in the group buffer. - -@item gnus-carpal-summary-buffer-buttons -@vindex gnus-carpal-summary-buffer-buttons -Buttons in the summary buffer. - -@item gnus-carpal-server-buffer-buttons -@vindex gnus-carpal-server-buffer-buttons -Buttons in the server buffer. - -@item gnus-carpal-browse-buffer-buttons -@vindex gnus-carpal-browse-buffer-buttons -Buttons in the browse buffer. -@end table - -All the @code{buttons} variables are lists. The elements in these list -are either cons cells where the @code{car} contains a text to be displayed and -the @code{cdr} contains a function symbol, or a simple string. - - @node Daemons @section Daemons @cindex demons @@ -26651,10 +26592,6 @@ You can do lots of strange stuff with the Gnus window & frame configuration (@pxref{Window Layout}). -@item -You can click on buttons instead of using the keyboard -(@pxref{Buttons}). - @end itemize === modified file 'lisp/gnus/ChangeLog' --- lisp/gnus/ChangeLog 2010-10-04 13:17:48 +0000 +++ lisp/gnus/ChangeLog 2010-10-04 22:26:51 +0000 @@ -1,11 +1,64 @@ 2010-10-04 Lars Magne Ingebrigtsen + * shr.el (shr-tag-blockquote): Ensure paragraph after quote, too. + (shr-get-image-data): Ensure against the cache file missing. + + * nnimap.el (nnimap-finish-retrieve-group-infos): Message while waiting + for data. + + * spam-report.el (spam-report-url-ping-plain): Don't query about + killing the process. + + * shr.el (shr-render-td): Protect against too-wide text. + +2010-10-04 Julien Danjou + + * mml-smime.el (mml-smime-openssl-encrypt-query): Fix choices. + (mml-smime-openssl-sign-query): Fix gnus-completing-read call. + + * gravatar.el (gravatar-retrieved): Kill buffer when gravatar has been + retrieved. + +2010-10-04 Lars Magne Ingebrigtsen + + * shr.el (browse-url): Required. + (shr-ensure-paragraph): Don't insert a new newline after empty-ish + lines. + (shr-show-alt-text, shr-browse-image): New commands. + (shr-browse-url, shr-copy-url): New commands. + + * gnus-sum.el (gnus-widen-article-window): New variable. + (gnus-summary-select-article-buffer): Use it. + + * message.el (message-idna-to-ascii-rhs-1): Don't bug out on addresses + without @ signs. + +2010-10-04 Michael Welsh Duggan (tiny change) + + * nnir.el (nnir-run-imap): Remove spurious space in search string. + +2010-10-04 Julien Danjou + + * gnus-util.el (gnus-emacs-completing-read): Mapcar collection to list, + for XEmacs. + +2010-10-04 Lars Magne Ingebrigtsen + + * gnus-salt.el: Remove all gnus-carpal stuff -- it's not useful. + + * nnimap.el (nnimap-open-connection): Allow tls as a synonym for ssl. + (nnimap-close-server): Implement. + * shr.el (shr-ensure-paragraph): Fix the non-empty line case. (shr-insert): Tweak line breaking. (shr-insert): Handle
 better.
 	(shr-tag-li): Get 
  • indentation right. (shr-tag-li): Get
  • indentation even righter. (shr-tag-blockquote): Ensure paragraph start. + (shr-make-table): Tweak table generation. + (shr-make-table): Fix typo. + + * shr.el: Implement table rendering. 2010-10-04 Julien Danjou @@ -1458,8 +1511,6 @@ * nnimap.el (nnimap-open-connection): If the user doesn't have a /etc/services, supply some sensible port defaults. - * dgnushack.el: Define netrc-credentials. - 2010-09-17 Julien Danjou * mm-decode.el (mm-text-html-renderer): Document gnus-article-html. === modified file 'lisp/gnus/gnus-group.el' --- lisp/gnus/gnus-group.el 2010-10-01 23:08:25 +0000 +++ lisp/gnus/gnus-group.el 2010-10-04 22:26:51 +0000 @@ -1186,9 +1186,7 @@ (defun gnus-group-setup-buffer () (set-buffer (gnus-get-buffer-create gnus-group-buffer)) (unless (eq major-mode 'gnus-group-mode) - (gnus-group-mode) - (when gnus-carpal - (gnus-carpal-setup-buffer 'group)))) + (gnus-group-mode))) (defun gnus-group-name-charset (method group) (if (null method) === modified file 'lisp/gnus/gnus-salt.el' --- lisp/gnus/gnus-salt.el 2010-09-02 00:55:51 +0000 +++ lisp/gnus/gnus-salt.el 2010-10-04 22:26:51 +0000 @@ -869,177 +869,6 @@ (set-window-point (gnus-get-buffer-window (current-buffer) t) (cdr region)))))) -;;; -;;; gnus-carpal -;;; - -(defvar gnus-carpal-group-buffer-buttons - '(("next" . gnus-group-next-unread-group) - ("prev" . gnus-group-prev-unread-group) - ("read" . gnus-group-read-group) - ("select" . gnus-group-select-group) - ("catch-up" . gnus-group-catchup-current) - ("new-news" . gnus-group-get-new-news-this-group) - ("toggle-sub" . gnus-group-unsubscribe-current-group) - ("subscribe" . gnus-group-unsubscribe-group) - ("kill" . gnus-group-kill-group) - ("yank" . gnus-group-yank-group) - ("describe" . gnus-group-describe-group) - "list" - ("subscribed" . gnus-group-list-groups) - ("all" . gnus-group-list-all-groups) - ("killed" . gnus-group-list-killed) - ("zombies" . gnus-group-list-zombies) - ("matching" . gnus-group-list-matching) - ("post" . gnus-group-post-news) - ("mail" . gnus-group-mail) - ("local" . (lambda () (interactive) (gnus-group-news 0))) - ("rescan" . gnus-group-get-new-news) - ("browse-foreign" . gnus-group-browse-foreign) - ("exit" . gnus-group-exit))) - -(defvar gnus-carpal-summary-buffer-buttons - '("mark" - ("read" . gnus-summary-mark-as-read-forward) - ("tick" . gnus-summary-tick-article-forward) - ("clear" . gnus-summary-clear-mark-forward) - ("expirable" . gnus-summary-mark-as-expirable) - "move" - ("scroll" . gnus-summary-next-page) - ("next-unread" . gnus-summary-next-unread-article) - ("prev-unread" . gnus-summary-prev-unread-article) - ("first" . gnus-summary-first-unread-article) - ("best" . gnus-summary-best-unread-article) - "article" - ("headers" . gnus-summary-toggle-header) - ("uudecode" . gnus-uu-decode-uu) - ("enter-digest" . gnus-summary-enter-digest-group) - ("fetch-parent" . gnus-summary-refer-parent-article) - "mail" - ("move" . gnus-summary-move-article) - ("copy" . gnus-summary-copy-article) - ("respool" . gnus-summary-respool-article) - "threads" - ("lower" . gnus-summary-lower-thread) - ("kill" . gnus-summary-kill-thread) - "post" - ("post" . gnus-summary-post-news) - ("local" . gnus-summary-news-other-window) - ("mail" . gnus-summary-mail-other-window) - ("followup" . gnus-summary-followup-with-original) - ("reply" . gnus-summary-reply-with-original) - ("cancel" . gnus-summary-cancel-article) - "misc" - ("exit" . gnus-summary-exit) - ("fed-up" . gnus-summary-catchup-and-goto-next-group))) - -(defvar gnus-carpal-server-buffer-buttons - '(("add" . gnus-server-add-server) - ("browse" . gnus-server-browse-server) - ("list" . gnus-server-list-servers) - ("kill" . gnus-server-kill-server) - ("yank" . gnus-server-yank-server) - ("copy" . gnus-server-copy-server) - ("exit" . gnus-server-exit))) - -(defvar gnus-carpal-browse-buffer-buttons - '(("subscribe" . gnus-browse-unsubscribe-current-group) - ("exit" . gnus-browse-exit))) - -(defvar gnus-carpal-group-buffer "*Carpal Group*") -(defvar gnus-carpal-summary-buffer "*Carpal Summary*") -(defvar gnus-carpal-server-buffer "*Carpal Server*") -(defvar gnus-carpal-browse-buffer "*Carpal Browse*") - -(defvar gnus-carpal-attached-buffer nil) - -(defvar gnus-carpal-mode-hook nil - "*Hook run in carpal mode buffers.") - -(defvar gnus-carpal-button-face 'bold - "*Face used on carpal buttons.") - -(defvar gnus-carpal-header-face 'bold-italic - "*Face used on carpal buffer headers.") - -(defvar gnus-carpal-mode-map nil) -(put 'gnus-carpal-mode 'mode-class 'special) - -(if gnus-carpal-mode-map - nil - (setq gnus-carpal-mode-map (make-keymap)) - (suppress-keymap gnus-carpal-mode-map) - (define-key gnus-carpal-mode-map " " 'gnus-carpal-select) - (define-key gnus-carpal-mode-map "\r" 'gnus-carpal-select) - (define-key gnus-carpal-mode-map gnus-mouse-2 'gnus-carpal-mouse-select)) - -(defun gnus-carpal-mode () - "Major mode for clicking buttons. - -All normal editing commands are switched off. -\\ -The following commands are available: - -\\{gnus-carpal-mode-map}" - (interactive) - (kill-all-local-variables) - (setq mode-line-modified (cdr gnus-mode-line-modified)) - (setq major-mode 'gnus-carpal-mode) - (setq mode-name "Gnus Carpal") - (setq mode-line-process nil) - (use-local-map gnus-carpal-mode-map) - (buffer-disable-undo) - (setq buffer-read-only t) - (make-local-variable 'gnus-carpal-attached-buffer) - (gnus-run-mode-hooks 'gnus-carpal-mode-hook)) - -(defun gnus-carpal-setup-buffer (type) - (let ((buffer (symbol-value (intern (format "gnus-carpal-%s-buffer" type))))) - (if (get-buffer buffer) - () - (with-current-buffer (gnus-get-buffer-create buffer) - (gnus-carpal-mode) - (setq gnus-carpal-attached-buffer - (intern (format "gnus-%s-buffer" type))) - (let ((buttons (symbol-value - (intern (format "gnus-carpal-%s-buffer-buttons" - type)))) - (buffer-read-only nil) - button) - (while buttons - (setq button (car buttons) - buttons (cdr buttons)) - (if (stringp button) - (set-text-properties - (point) - (prog2 (insert button) (point) (insert " ")) - (list 'face gnus-carpal-header-face)) - (set-text-properties - (point) - (prog2 (insert (car button)) (point) (insert " ")) - (list 'gnus-callback (cdr button) - 'face gnus-carpal-button-face - gnus-mouse-face-prop 'highlight)))) - (let ((fill-column (- (window-width) 2))) - (fill-region (point-min) (point-max))) - (set-window-point (get-buffer-window (current-buffer)) - (point-min))))))) - -(defun gnus-carpal-select () - "Select the button under point." - (interactive) - (let ((func (get-text-property (point) 'gnus-callback))) - (if (null func) - () - (pop-to-buffer (symbol-value gnus-carpal-attached-buffer)) - (call-interactively func)))) - -(defun gnus-carpal-mouse-select (event) - "Select the button under the mouse pointer." - (interactive "e") - (mouse-set-point event) - (gnus-carpal-select)) - ;;; Allow redefinition of functions. (gnus-ems-redefine) === modified file 'lisp/gnus/gnus-srvr.el' --- lisp/gnus/gnus-srvr.el 2010-09-30 08:39:23 +0000 +++ lisp/gnus/gnus-srvr.el 2010-10-04 22:26:51 +0000 @@ -301,9 +301,7 @@ "Initialize the server buffer." (unless (get-buffer gnus-server-buffer) (with-current-buffer (gnus-get-buffer-create gnus-server-buffer) - (gnus-server-mode) - (when gnus-carpal - (gnus-carpal-setup-buffer 'server))))) + (gnus-server-mode)))) (defun gnus-server-prepare () (gnus-set-format 'server-mode) @@ -806,8 +804,6 @@ (funcall gnus-group-prepare-function gnus-level-killed 'ignore 1 'ignore)) (gnus-get-buffer-create gnus-browse-buffer) - (when gnus-carpal - (gnus-carpal-setup-buffer 'browse)) (gnus-configure-windows 'browse) (buffer-disable-undo) (let ((buffer-read-only nil)) === modified file 'lisp/gnus/gnus-sum.el' --- lisp/gnus/gnus-sum.el 2010-10-04 00:17:16 +0000 +++ lisp/gnus/gnus-sum.el 2010-10-04 22:26:51 +0000 @@ -474,6 +474,12 @@ :group 'gnus-article-various :type 'boolean) +(defcustom gnus-widen-article-window nil + "If non-nil, selecting the article buffer will display only the article buffer." + :version "24.1" + :group 'gnus-article-various + :type 'boolean) + (defcustom gnus-break-pages t "*If non-nil, do page breaking on articles. The page delimiter is specified by the `gnus-page-delimiter' @@ -3493,8 +3499,6 @@ ;; Fix by Sudish Joseph (setq gnus-summary-buffer (set-buffer (gnus-get-buffer-create buffer))) (gnus-summary-mode group) - (when gnus-carpal - (gnus-carpal-setup-buffer 'summary)) (when (gnus-group-quit-config group) (set (make-local-variable 'gnus-single-article-buffer) nil)) (make-local-variable 'gnus-article-buffer) @@ -6935,7 +6939,11 @@ (error "There is no article buffer for this summary buffer") (unless (get-buffer-window gnus-article-buffer) (gnus-summary-show-article)) - (gnus-configure-windows 'article t) + (gnus-configure-windows + (if gnus-widen-article-window + 'only-article + 'article) + t) (select-window (get-buffer-window gnus-article-buffer)))) (defun gnus-summary-universal-argument (arg) === modified file 'lisp/gnus/gnus-util.el' --- lisp/gnus/gnus-util.el 2010-10-04 00:17:16 +0000 +++ lisp/gnus/gnus-util.el 2010-10-04 22:26:51 +0000 @@ -1602,7 +1602,11 @@ initial-input history def) "Call standard `completing-read-function'." (let ((completion-styles gnus-completion-styles)) - (completing-read prompt collection nil require-match initial-input history def))) + (completing-read prompt + ;; Old XEmacs (at least 21.4) expect an alist for + ;; collection. + (mapcar 'list collection) + nil require-match initial-input history def))) (defun gnus-ido-completing-read (prompt collection &optional require-match initial-input history def) === modified file 'lisp/gnus/gnus-win.el' --- lisp/gnus/gnus-win.el 2010-10-01 23:08:25 +0000 +++ lisp/gnus/gnus-win.el 2010-10-04 22:26:51 +0000 @@ -68,12 +68,10 @@ (defvar gnus-buffer-configuration '((group (vertical 1.0 - (group 1.0 point) - (if gnus-carpal '(group-carpal 4)))) + (group 1.0 point))) (summary (vertical 1.0 - (summary 1.0 point) - (if gnus-carpal '(summary-carpal 4)))) + (summary 1.0 point))) (article (cond (gnus-use-trees @@ -84,16 +82,13 @@ (t '(vertical 1.0 (summary 0.25 point) - (if gnus-carpal '(summary-carpal 4)) (article 1.0))))) (server (vertical 1.0 - (server 1.0 point) - (if gnus-carpal '(server-carpal 2)))) + (server 1.0 point))) (browse (vertical 1.0 - (browse 1.0 point) - (if gnus-carpal '(browse-carpal 2)))) + (browse 1.0 point))) (message (vertical 1.0 (message 1.0 point))) @@ -145,7 +140,6 @@ (pipe (vertical 1.0 (summary 0.25 point) - (if gnus-carpal '(summary-carpal 4)) ("*Shell Command Output*" 1.0))) (bug (vertical 1.0 @@ -189,10 +183,6 @@ (edit-group . gnus-group-edit-buffer) (edit-form . gnus-edit-form-buffer) (edit-server . gnus-server-edit-buffer) - (group-carpal . gnus-carpal-group-buffer) - (summary-carpal . gnus-carpal-summary-buffer) - (server-carpal . gnus-carpal-server-buffer) - (browse-carpal . gnus-carpal-browse-buffer) (edit-score . gnus-score-edit-buffer) (message . gnus-message-buffer) (mail . gnus-message-buffer) === modified file 'lisp/gnus/gnus.el' --- lisp/gnus/gnus.el 2010-10-01 23:08:25 +0000 +++ lisp/gnus/gnus.el 2010-10-04 22:26:51 +0000 @@ -1626,11 +1626,6 @@ (function-item mail-extract-address-components) (function :tag "Other"))) -(defcustom gnus-carpal nil - "*If non-nil, display clickable icons." - :group 'gnus-meta - :type 'boolean) - (defcustom gnus-shell-command-separator ";" "String used to separate shell commands." :group 'gnus-files @@ -2803,7 +2798,7 @@ gnus-convert-image-to-gray-x-face gnus-convert-face-to-png gnus-face-from-file) ("gnus-salt" gnus-highlight-selected-tree gnus-possibly-generate-tree - gnus-tree-open gnus-tree-close gnus-carpal-setup-buffer) + gnus-tree-open gnus-tree-close) ("gnus-srvr" gnus-enter-server-buffer gnus-server-set-info gnus-server-server-name) ("gnus-srvr" gnus-browse-foreign-server) === modified file 'lisp/gnus/gravatar.el' --- lisp/gnus/gravatar.el 2010-10-01 05:50:11 +0000 +++ lisp/gnus/gravatar.el 2010-10-04 22:26:51 +0000 @@ -125,7 +125,8 @@ (if (plist-get status :error) ;; Error happened. (apply cb 'error cbargs) - (apply cb (gravatar-data->image) cbargs))) + (apply cb (gravatar-data->image) cbargs)) + (kill-buffer (current-buffer))) (provide 'gravatar) === modified file 'lisp/gnus/message.el' --- lisp/gnus/message.el 2010-10-01 23:08:25 +0000 +++ lisp/gnus/message.el 2010-10-04 22:26:51 +0000 @@ -5736,7 +5736,9 @@ (mapcar (lambda (rhs) (or (cadr (split-string rhs "@")) "")) (mapcar 'downcase (mapcar - 'cadr + (lambda (elem) + (or (cadr elem) + "")) (mail-extract-address-components field t)))))) ;; Note that `rhs' will be "" if the address does not have ;; the domain part, i.e., if it is a local user's address. === modified file 'lisp/gnus/mml-smime.el' --- lisp/gnus/mml-smime.el 2010-09-30 08:39:23 +0000 +++ lisp/gnus/mml-smime.el 2010-10-04 22:26:51 +0000 @@ -162,7 +162,7 @@ (and from (smime-get-key-by-email from))) (smime-get-key-by-email (gnus-completing-read "Sign this part with what signature" - smime-keys nil nil + (mapcar 'car smime-keys) nil nil nil (and (listp (car-safe smime-keys)) (caar smime-keys)))))))) @@ -221,7 +221,7 @@ (while (not done) (ecase (read (gnus-completing-read "Fetch certificate from" - '(("dns") ("ldap") ("file")) t nil nil + '("dns" "ldap" "file") t nil nil "ldap")) (dns (setq certs (append certs (mml-smime-get-dns-cert)))) === modified file 'lisp/gnus/nnimap.el' --- lisp/gnus/nnimap.el 2010-10-01 23:08:25 +0000 +++ lisp/gnus/nnimap.el 2010-10-04 22:26:51 +0000 @@ -316,7 +316,7 @@ (setq port (or nnimap-server-port "imap")) 'starttls)) '("imap")) - ((eq nnimap-stream 'ssl) + ((memq nnimap-stream '(ssl tls)) (open-tls-stream "*nnimap*" (current-buffer) nnimap-address (setq port @@ -324,7 +324,9 @@ (if (netrc-find-service-number "imaps") "imaps" "993")))) - '("143" "993" "imap" "imaps")))) + '("143" "993" "imap" "imaps")) + (t + (error "Unknown stream type: %s" nnimap-stream)))) connection-result login-result credentials) (setf (nnimap-process nnimap-object) (get-buffer-process (current-buffer))) @@ -424,7 +426,10 @@ result)) (deffoo nnimap-close-server (&optional server) - t) + (when (nnoo-change-server 'nnimap server nil) + (ignore-errors + (delete-process (get-buffer-process (nnimap-buffer)))) + t)) (deffoo nnimap-request-close () t) @@ -974,7 +979,7 @@ (nnimap-possibly-change-group nil server)) (with-current-buffer (nnimap-buffer) ;; Wait for the final data to trickle in. - (when (nnimap-wait-for-response (cadar sequences)) + (when (nnimap-wait-for-response (cadar sequences) t) ;; Now we should have all the data we need, no matter whether ;; we're QRESYNCING, fetching all the flags from scratch, or ;; just fetching the last 100 flags per group. @@ -1251,7 +1256,7 @@ (point-min)) t))) (when messagep - (message "Read %dKB" (/ (buffer-size) 1000))) + (message "nnimap read %dk" (/ (buffer-size) 1000))) (nnheader-accept-process-output process) (goto-char (point-max))) openp)) === modified file 'lisp/gnus/nnir.el' --- lisp/gnus/nnir.el 2010-10-01 00:25:50 +0000 +++ lisp/gnus/nnir.el 2010-10-04 22:26:51 +0000 @@ -985,7 +985,7 @@ (message "Searching %s..." group) (let ((arts 0) (result - (nnimap-command "UID SEARCH %s" + (nnimap-command "UID SEARCH %s" (if (string= criteria "") qstring (nnir-imap-make-query criteria qstring) === modified file 'lisp/gnus/shr.el' --- lisp/gnus/shr.el 2010-10-04 13:17:48 +0000 +++ lisp/gnus/shr.el 2010-10-04 22:26:51 +0000 @@ -30,6 +30,8 @@ ;;; Code: +(require 'browse-url) + (defgroup shr nil "Simple HTML Renderer" :group 'mail) @@ -57,6 +59,16 @@ (defvar shr-width 70) +(defvar shr-map + (let ((map (make-sparse-keymap))) + (define-key map "a" 'shr-show-alt-text) + (define-key map "i" 'shr-browse-image) + (define-key map "I" 'shr-insert-image) + (define-key map "u" 'shr-copy-url) + (define-key map "v" 'shr-browse-url) + (define-key map "\r" 'shr-browse-url) + map)) + (defun shr-transform-dom (dom) (let ((result (list (pop dom)))) (dolist (arg (pop dom)) @@ -97,7 +109,9 @@ (defun shr-ensure-paragraph () (unless (bobp) (if (bolp) - (unless (eql (char-after (- (point) 2)) ?\n) + (unless (save-excursion + (forward-line -1) + (looking-at " *$")) (insert "\n")) (if (save-excursion (beginning-of-line) @@ -129,17 +143,53 @@ (defun shr-tag-a (cont) (let ((url (cdr (assq :href cont))) + (start (point)) shr-start) (shr-generic cont) (widget-convert-button - 'link shr-start (point) - :action 'shr-browse-url - :url url - :keymap widget-keymap - :help-echo url))) - -(defun shr-browse-url (widget &rest stuff) - (browse-url (widget-get widget :url))) + 'link (or shr-start start) (point) + :help-echo url) + (put-text-property (or shr-start start) (point) 'keymap shr-map) + (put-text-property (or shr-start start) (point) 'shr-url url))) + +(defun shr-browse-url () + "Browse the URL under point." + (interactive) + (let ((url (get-text-property (point) 'shr-url))) + (if (not url) + (message "No link under point") + (browse-url url)))) + +(defun shr-copy-url () + "Copy the URL under point to the kill ring. +If called twice, then try to fetch the URL and see whether it +redirects somewhere else." + (interactive) + (let ((url (get-text-property (point) 'shr-url))) + (cond + ((not url) + (message "No URL under point")) + ;; Resolve redirected URLs. + ((equal url (car kill-ring)) + (url-retrieve + url + (lambda (a) + (when (and (consp a) + (eq (car a) :redirect)) + (with-temp-buffer + (insert (cadr a)) + (goto-char (point-min)) + ;; Remove common tracking junk from the URL. + (when (re-search-forward ".utm_.*" nil t) + (replace-match "" t t)) + (message "Copied %s" (buffer-string)) + (copy-region-as-kill (point-min) (point-max))))))) + ;; Copy the URL to the kill ring. + (t + (with-temp-buffer + (insert url) + (copy-region-as-kill (point-min) (point-max)) + (message "Copied %s" url)))))) (defun shr-tag-img (cont) (when (and (> (current-column) 0) @@ -162,8 +212,28 @@ (list (current-buffer) start (point-marker)) t))) (insert " ") + (put-text-property start (point) 'keymap shr-map) + (put-text-property start (point) 'shr-alt alt) + (put-text-property start (point) 'shr-image url) (setq shr-state 'image)))) +(defun shr-show-alt-text () + "Show the ALT text of the image under point." + (interactive) + (let ((text (get-text-property (point) 'shr-alt))) + (if (not text) + (message "No image under point") + (message "%s" text)))) + +(defun shr-browse-image () + "Browse the image under point." + (interactive) + (let ((url (get-text-property (point) 'shr-image))) + (if (not url) + (message "No image under point") + (message "Browsing %s..." url) + (browse-url url)))) + (defun shr-image-fetched (status buffer start end) (when (and (buffer-name buffer) (not (plist-get status :error))) @@ -222,7 +292,8 @@ (defun shr-tag-blockquote (cont) (shr-ensure-paragraph) (let ((shr-indentation (+ shr-indentation 4))) - (shr-generic cont))) + (shr-generic cont)) + (shr-ensure-paragraph)) (defun shr-ensure-newline () (unless (zerop (current-column)) @@ -254,7 +325,7 @@ (setq first nil) (when (and (bolp) (> shr-indentation 0)) - (insert (make-string shr-indentation ? ))) + (shr-indent)) ;; The shr-start is a special variable that is used to pass ;; upwards the first point in the buffer where the text really ;; starts. @@ -267,15 +338,20 @@ (insert " ") (setq shr-state 'space)))))) +(defun shr-indent () + (insert (make-string shr-indentation ? ))) + (defun shr-get-image-data (url) "Get image data for URL. Return a string with image data." (with-temp-buffer (mm-disable-multibyte) - (url-cache-extract (url-cache-create-filename url)) - (when (or (search-forward "\n\n" nil t) - (search-forward "\r\n\r\n" nil t)) - (buffer-substring (point) (point-max))))) + (when (ignore-errors + (url-cache-extract (url-cache-create-filename url)) + t) + (when (or (search-forward "\n\n" nil t) + (search-forward "\r\n\r\n" nil t)) + (buffer-substring (point) (point-max)))))) (defvar shr-list-mode nil) @@ -328,6 +404,140 @@ (apply #'shr-fontize-cont cont types) (shr-ensure-paragraph)) +(defun shr-tag-table (cont) + (shr-ensure-paragraph) + (setq cont (or (cdr (assq 'tbody cont)) + cont)) + (let* ((columns (shr-column-specs cont)) + (suggested-widths (shr-pro-rate-columns columns)) + (sketch (shr-make-table cont suggested-widths)) + (sketch-widths (shr-table-widths sketch (length suggested-widths)))) + (shr-insert-table (shr-make-table cont sketch-widths t) sketch-widths))) + +(defun shr-insert-table (table widths) + (shr-insert-table-ruler widths) + (dolist (row table) + (let ((start (point)) + (height (let ((max 0)) + (dolist (column row) + (setq max (max max (cadr column)))) + max))) + (dotimes (i height) + (shr-indent) + (insert "|\n")) + (dolist (column row) + (goto-char start) + (let ((lines (split-string (nth 2 column) "\n"))) + (dolist (line lines) + (when (> (length line) 0) + (end-of-line) + (insert line "|") + (forward-line 1))) + ;; Add blank lines at padding at the bottom of the TD, + ;; possibly. + (dotimes (i (- height (length lines))) + (end-of-line) + (insert (make-string (length (car lines)) ? ) "|") + (forward-line 1))))) + (shr-insert-table-ruler widths))) + +(defun shr-insert-table-ruler (widths) + (shr-indent) + (insert "+") + (dotimes (i (length widths)) + (insert (make-string (aref widths i) ?-) ?+)) + (insert "\n")) + +(defun shr-table-widths (table length) + (let ((widths (make-vector length 0))) + (dolist (row table) + (let ((i 0)) + (dolist (column row) + (aset widths i (max (aref widths i) + (car column))) + (incf i)))) + widths)) + +(defun shr-make-table (cont widths &optional fill) + (let ((trs nil)) + (dolist (row cont) + (when (eq (car row) 'tr) + (let ((i 0) + (tds nil)) + (dolist (column (cdr row)) + (when (memq (car column) '(td th)) + (push (shr-render-td (cdr column) (aref widths i) fill) + tds) + (setq i (1+ i)))) + (push (nreverse tds) trs)))) + (nreverse trs))) + +(defun shr-render-td (cont width fill) + (with-temp-buffer + (let ((shr-width width) + (shr-indentation 0)) + (shr-generic cont)) + (while (re-search-backward "\n *$" nil t) + (delete-region (match-beginning 0) (match-end 0))) + (goto-char (point-min)) + (let ((max 0)) + (while (not (eobp)) + (end-of-line) + (setq max (max max (current-column))) + (forward-line 1)) + (when fill + (goto-char (point-min)) + (while (not (eobp)) + (end-of-line) + (when (> (- width (current-column)) 0) + (insert (make-string (- width (current-column)) ? ))) + (forward-line 1))) + (list max (count-lines (point-min) (point-max)) (buffer-string))))) + +(defun shr-pro-rate-columns (columns) + (let ((total-percentage 0) + (widths (make-vector (length columns) 0))) + (dotimes (i (length columns)) + (incf total-percentage (aref columns i))) + (setq total-percentage (/ 1.0 total-percentage)) + (dotimes (i (length columns)) + (aset widths i (max (truncate (* (aref columns i) + total-percentage + shr-width)) + 10))) + widths)) + +;; Return a summary of the number and shape of the TDs in the table. +(defun shr-column-specs (cont) + (let ((columns (make-vector (shr-max-columns cont) 1))) + (dolist (row cont) + (when (eq (car row) 'tr) + (let ((i 0)) + (dolist (column (cdr row)) + (when (memq (car column) '(td th)) + (let ((width (cdr (assq :width (cdr column))))) + (when (and width + (string-match "\\([0-9]+\\)%" width)) + (aset columns i + (/ (string-to-number (match-string 1 width)) + 100.0))))) + (setq i (1+ i)))))) + columns)) + +(defun shr-count (cont elem) + (let ((i 0)) + (dolist (sub cont) + (when (eq (car sub) elem) + (setq i (1+ i)))) + i)) + +(defun shr-max-columns (cont) + (let ((max 0)) + (dolist (row cont) + (when (eq (car row) 'tr) + (setq max (max max (shr-count (cdr row) 'td))))) + max)) + (provide 'shr) ;;; shr.el ends here === modified file 'lisp/gnus/spam-report.el' --- lisp/gnus/spam-report.el 2010-09-18 10:02:19 +0000 +++ lisp/gnus/spam-report.el 2010-10-04 22:26:51 +0000 @@ -256,6 +256,7 @@ 80)) (error "Could not open connection to %s" host)) (set-marker (process-mark tcp-connection) (point-min)) + (gnus-set-process-query-on-exit-flag tcp-connection nil) (process-send-string tcp-connection (format "GET %s HTTP/1.1\nUser-Agent: %s\nHost: %s\n\n" ------------------------------------------------------------ revno: 101790 committer: Michael Albinus branch nick: trunk timestamp: Mon 2010-10-04 21:44:08 +0200 message: Continue reorganization of load dependencies. (Bug#7156) * net/tramp.el (tramp-handle-file-local-copy-hook) (tramp-delete-temp-file-function): Move down. (tramp-exists-file-name-handler): Move up. (tramp-register-file-name-handlers): Simplify autoload. (tramp-handle-write-region-hook, tramp-handle-directory-file-name) (tramp-handle-directory-files, tramp-handle-dired-uncache) (tramp-handle-file-modes, tramp-handle-file-name-as-directory) (tramp-handle-file-name-completion) (tramp-handle-file-name-directory) (tramp-handle-file-name-nondirectory, tramp-handle-file-regular-p) (tramp-handle-file-remote-p, tramp-handle-file-symlink-p) (tramp-handle-find-backup-file-name) (tramp-handle-insert-file-contents, tramp-handle-load) (tramp-handle-substitute-in-file-name) (tramp-handle-unhandled-file-name-directory) (tramp-mode-string-to-int, tramp-local-host-p) (tramp-make-tramp-temp-file): Moved from tramp-sh.el. * net/tramp-gvfs.el (top): * net/tramp-smb.el (top): Do not require 'tramp-sh. * net/tramp-sh.el (all): Move several objects to tramp.el, see there. Rename `tramp-handle-*' to `tramp-sh-handle-*'. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2010-10-04 01:19:56 +0000 +++ lisp/ChangeLog 2010-10-04 19:44:08 +0000 @@ -1,3 +1,31 @@ +2010-10-04 Michael Albinus + + Continue reorganization of load dependencies. (Bug#7156) + + * net/tramp.el (tramp-handle-file-local-copy-hook) + (tramp-delete-temp-file-function): Move down. + (tramp-exists-file-name-handler): Move up. + (tramp-register-file-name-handlers): Simplify autoload. + (tramp-handle-write-region-hook, tramp-handle-directory-file-name) + (tramp-handle-directory-files, tramp-handle-dired-uncache) + (tramp-handle-file-modes, tramp-handle-file-name-as-directory) + (tramp-handle-file-name-completion) + (tramp-handle-file-name-directory) + (tramp-handle-file-name-nondirectory, tramp-handle-file-regular-p) + (tramp-handle-file-remote-p, tramp-handle-file-symlink-p) + (tramp-handle-find-backup-file-name) + (tramp-handle-insert-file-contents, tramp-handle-load) + (tramp-handle-substitute-in-file-name) + (tramp-handle-unhandled-file-name-directory) + (tramp-mode-string-to-int, tramp-local-host-p) + (tramp-make-tramp-temp-file): Moved from tramp-sh.el. + + * net/tramp-gvfs.el (top): + * net/tramp-smb.el (top): Do not require 'tramp-sh. + + * net/tramp-sh.el (all): Move several objects to tramp.el, see + there. Rename `tramp-handle-*' to `tramp-sh-handle-*'. + 2010-10-04 Glenn Morris * calendar/appt.el (appt-add): Ensure reminders are enabled. === modified file 'lisp/net/tramp-gvfs.el' --- lisp/net/tramp-gvfs.el 2010-10-02 13:21:43 +0000 +++ lisp/net/tramp-gvfs.el 2010-10-04 19:44:08 +0000 @@ -104,10 +104,6 @@ (require 'tramp) -;; We call several `tramp-handle-*' functions directly. So we must -;; reqire that package as well. -(require 'tramp-sh) - (require 'dbus) (require 'url-parse) (require 'url-util) @@ -405,6 +401,7 @@ (file-name-directory . tramp-handle-file-name-directory) (file-name-nondirectory . tramp-handle-file-name-nondirectory) ;; `file-name-sans-versions' performed by default handler. + ;; CCC: Must be checked! (file-newer-than-file-p . tramp-handle-file-newer-than-file-p) (file-ownership-preserved-p . ignore) (file-readable-p . tramp-gvfs-handle-file-readable-p) === modified file 'lisp/net/tramp-sh.el' --- lisp/net/tramp-sh.el 2010-10-02 13:21:43 +0000 +++ lisp/net/tramp-sh.el 2010-10-04 19:44:08 +0000 @@ -620,7 +620,7 @@ ;; unless this spits out a complete line, including the '\n' at the ;; end. ;; The device number is returned as "-1", because there will be a virtual -;; device number set in `tramp-handle-file-attributes'. +;; device number set in `tramp-sh-handle-file-attributes'. (defconst tramp-perl-file-attributes "%s -e ' @stat = lstat($ARGV[0]); @@ -867,62 +867,63 @@ ;; get-file-buffer. (defconst tramp-sh-file-name-handler-alist '((load . tramp-handle-load) - (make-symbolic-link . tramp-handle-make-symbolic-link) + (make-symbolic-link . tramp-sh-handle-make-symbolic-link) (file-name-as-directory . tramp-handle-file-name-as-directory) (file-name-directory . tramp-handle-file-name-directory) (file-name-nondirectory . tramp-handle-file-name-nondirectory) - (file-truename . tramp-handle-file-truename) - (file-exists-p . tramp-handle-file-exists-p) - (file-directory-p . tramp-handle-file-directory-p) - (file-executable-p . tramp-handle-file-executable-p) - (file-readable-p . tramp-handle-file-readable-p) + (file-truename . tramp-sh-handle-file-truename) + (file-exists-p . tramp-sh-handle-file-exists-p) + (file-directory-p . tramp-sh-handle-file-directory-p) + (file-executable-p . tramp-sh-handle-file-executable-p) + (file-readable-p . tramp-sh-handle-file-readable-p) (file-regular-p . tramp-handle-file-regular-p) (file-symlink-p . tramp-handle-file-symlink-p) - (file-writable-p . tramp-handle-file-writable-p) - (file-ownership-preserved-p . tramp-handle-file-ownership-preserved-p) - (file-newer-than-file-p . tramp-handle-file-newer-than-file-p) - (file-attributes . tramp-handle-file-attributes) + (file-writable-p . tramp-sh-handle-file-writable-p) + (file-ownership-preserved-p . tramp-sh-handle-file-ownership-preserved-p) + (file-newer-than-file-p . tramp-sh-handle-file-newer-than-file-p) + (file-attributes . tramp-sh-handle-file-attributes) (file-modes . tramp-handle-file-modes) (directory-files . tramp-handle-directory-files) - (directory-files-and-attributes . tramp-handle-directory-files-and-attributes) - (file-name-all-completions . tramp-handle-file-name-all-completions) + (directory-files-and-attributes + . tramp-sh-handle-directory-files-and-attributes) + (file-name-all-completions . tramp-sh-handle-file-name-all-completions) (file-name-completion . tramp-handle-file-name-completion) - (add-name-to-file . tramp-handle-add-name-to-file) - (copy-file . tramp-handle-copy-file) - (copy-directory . tramp-handle-copy-directory) - (rename-file . tramp-handle-rename-file) - (set-file-modes . tramp-handle-set-file-modes) - (set-file-times . tramp-handle-set-file-times) - (make-directory . tramp-handle-make-directory) - (delete-directory . tramp-handle-delete-directory) - (delete-file . tramp-handle-delete-file) + (add-name-to-file . tramp-sh-handle-add-name-to-file) + (copy-file . tramp-sh-handle-copy-file) + (copy-directory . tramp-sh-handle-copy-directory) + (rename-file . tramp-sh-handle-rename-file) + (set-file-modes . tramp-sh-handle-set-file-modes) + (set-file-times . tramp-sh-handle-set-file-times) + (make-directory . tramp-sh-handle-make-directory) + (delete-directory . tramp-sh-handle-delete-directory) + (delete-file . tramp-sh-handle-delete-file) (directory-file-name . tramp-handle-directory-file-name) ;; `executable-find' is not official yet. - (executable-find . tramp-handle-executable-find) - (start-file-process . tramp-handle-start-file-process) - (process-file . tramp-handle-process-file) - (shell-command . tramp-handle-shell-command) - (insert-directory . tramp-handle-insert-directory) - (expand-file-name . tramp-handle-expand-file-name) + (executable-find . tramp-sh-handle-executable-find) + (start-file-process . tramp-sh-handle-start-file-process) + (process-file . tramp-sh-handle-process-file) + (shell-command . tramp-sh-handle-shell-command) + (insert-directory . tramp-sh-handle-insert-directory) + (expand-file-name . tramp-sh-handle-expand-file-name) (substitute-in-file-name . tramp-handle-substitute-in-file-name) - (file-local-copy . tramp-handle-file-local-copy) + (file-local-copy . tramp-sh-handle-file-local-copy) (file-remote-p . tramp-handle-file-remote-p) (insert-file-contents . tramp-handle-insert-file-contents) (insert-file-contents-literally - . tramp-handle-insert-file-contents-literally) - (write-region . tramp-handle-write-region) - (find-backup-file-name . tramp-handle-find-backup-file-name) - (make-auto-save-file-name . tramp-handle-make-auto-save-file-name) + . tramp-sh-handle-insert-file-contents-literally) + (write-region . tramp-sh-handle-write-region) + (find-backup-file-name . tramp-sh-handle-find-backup-file-name) + (make-auto-save-file-name . tramp-sh-handle-make-auto-save-file-name) (unhandled-file-name-directory . tramp-handle-unhandled-file-name-directory) - (dired-compress-file . tramp-handle-dired-compress-file) + (dired-compress-file . tramp-sh-handle-dired-compress-file) (dired-recursive-delete-directory - . tramp-handle-dired-recursive-delete-directory) + . tramp-sh-handle-dired-recursive-delete-directory) (dired-uncache . tramp-handle-dired-uncache) - (set-visited-file-modtime . tramp-handle-set-visited-file-modtime) - (verify-visited-file-modtime . tramp-handle-verify-visited-file-modtime) - (file-selinux-context . tramp-handle-file-selinux-context) - (set-file-selinux-context . tramp-handle-set-file-selinux-context) - (vc-registered . tramp-handle-vc-registered)) + (set-visited-file-modtime . tramp-sh-handle-set-visited-file-modtime) + (verify-visited-file-modtime . tramp-sh-handle-verify-visited-file-modtime) + (file-selinux-context . tramp-sh-handle-file-selinux-context) + (set-file-selinux-context . tramp-sh-handle-set-file-selinux-context) + (vc-registered . tramp-sh-handle-vc-registered)) "Alist of handler functions. Operations not mentioned here will be handled by the normal Emacs functions.") @@ -933,7 +934,7 @@ ;;; File Name Handler Functions: -(defun tramp-handle-make-symbolic-link +(defun tramp-sh-handle-make-symbolic-link (filename linkname &optional ok-if-already-exists) "Like `make-symbolic-link' for Tramp files. If LINKNAME is a non-Tramp file, it is used verbatim as the target of @@ -988,71 +989,7 @@ (tramp-shell-quote-argument l-localname)) t)))) -(defun tramp-handle-load (file &optional noerror nomessage nosuffix must-suffix) - "Like `load' for Tramp files." - (with-parsed-tramp-file-name (expand-file-name file) nil - (unless nosuffix - (cond ((file-exists-p (concat file ".elc")) - (setq file (concat file ".elc"))) - ((file-exists-p (concat file ".el")) - (setq file (concat file ".el"))))) - (when must-suffix - ;; The first condition is always true for absolute file names. - ;; Included for safety's sake. - (unless (or (file-name-directory file) - (string-match "\\.elc?\\'" file)) - (tramp-error - v 'file-error - "File `%s' does not include a `.el' or `.elc' suffix" file))) - (unless noerror - (when (not (file-exists-p file)) - (tramp-error v 'file-error "Cannot load nonexistent file `%s'" file))) - (if (not (file-exists-p file)) - nil - (let ((tramp-message-show-message (not nomessage))) - (with-progress-reporter v 0 (format "Loading %s" file) - (let ((local-copy (file-local-copy file))) - ;; MUST-SUFFIX doesn't exist on XEmacs, so let it default to nil. - (unwind-protect - (load local-copy noerror t t) - (delete-file local-copy))))) - t))) - -;; Localname manipulation functions that grok Tramp localnames... -(defun tramp-handle-file-name-as-directory (file) - "Like `file-name-as-directory' but aware of Tramp files." - ;; `file-name-as-directory' would be sufficient except localname is - ;; the empty string. - (let ((v (tramp-dissect-file-name file t))) - ;; Run the command on the localname portion only. - (tramp-make-tramp-file-name - (tramp-file-name-method v) - (tramp-file-name-user v) - (tramp-file-name-host v) - (tramp-run-real-handler - 'file-name-as-directory (list (or (tramp-file-name-localname v) "")))))) - -(defun tramp-handle-file-name-directory (file) - "Like `file-name-directory' but aware of Tramp files." - ;; Everything except the last filename thing is the directory. We - ;; cannot apply `with-parsed-tramp-file-name', because this expands - ;; the remote file name parts. This is a problem when we are in - ;; file name completion. - (let ((v (tramp-dissect-file-name file t))) - ;; Run the command on the localname portion only. - (tramp-make-tramp-file-name - (tramp-file-name-method v) - (tramp-file-name-user v) - (tramp-file-name-host v) - (tramp-run-real-handler - 'file-name-directory (list (or (tramp-file-name-localname v) "")))))) - -(defun tramp-handle-file-name-nondirectory (file) - "Like `file-name-nondirectory' but aware of Tramp files." - (with-parsed-tramp-file-name file nil - (tramp-run-real-handler 'file-name-nondirectory (list localname)))) - -(defun tramp-handle-file-truename (filename &optional counter prev-dirs) +(defun tramp-sh-handle-file-truename (filename &optional counter prev-dirs) "Like `file-truename' for Tramp files." (with-parsed-tramp-file-name (expand-file-name filename) nil (with-file-property v localname "file-truename" @@ -1158,7 +1095,7 @@ ;; Basic functions. -(defun tramp-handle-file-exists-p (filename) +(defun tramp-sh-handle-file-exists-p (filename) "Like `file-exists-p' for Tramp files." (with-parsed-tramp-file-name filename nil (with-file-property v localname "file-exists-p" @@ -1176,7 +1113,7 @@ ;; CCC: This should check for an error condition and signal failure ;; when something goes wrong. ;; Daniel Pittman -(defun tramp-handle-file-attributes (filename &optional id-format) +(defun tramp-sh-handle-file-attributes (filename &optional id-format) "Like `file-attributes' for Tramp files." (unless id-format (setq id-format 'integer)) ;; Don't modify `last-coding-system-used' by accident. @@ -1314,7 +1251,7 @@ (if (eq id-format 'integer) "%g" "\"%G\"") (tramp-shell-quote-argument localname)))) -(defun tramp-handle-set-visited-file-modtime (&optional time-list) +(defun tramp-sh-handle-set-visited-file-modtime (&optional time-list) "Like `set-visited-file-modtime' for Tramp files." (unless (buffer-file-name) (error "Can't set-visited-file-modtime: buffer `%s' not visiting a file" @@ -1348,8 +1285,8 @@ nil))))) ;; This function makes the same assumption as -;; `tramp-handle-set-visited-file-modtime'. -(defun tramp-handle-verify-visited-file-modtime (buf) +;; `tramp-sh-handle-set-visited-file-modtime'. +(defun tramp-sh-handle-verify-visited-file-modtime (buf) "Like `verify-visited-file-modtime' for Tramp files. At the time `verify-visited-file-modtime' calls this function, we already know that the buffer is visiting a file and that @@ -1401,7 +1338,7 @@ ;; only if that agrees with the buffer's record. (t (equal mt '(-1 65535)))))))))) -(defun tramp-handle-set-file-modes (filename mode) +(defun tramp-sh-handle-set-file-modes (filename mode) "Like `set-file-modes' for Tramp files." (with-parsed-tramp-file-name filename nil (tramp-flush-file-property v localname) @@ -1413,7 +1350,7 @@ (tramp-shell-quote-argument localname)) "Error while changing file's mode %s" filename))) -(defun tramp-handle-set-file-times (filename &optional time) +(defun tramp-sh-handle-set-file-times (filename &optional time) "Like `set-file-times' for Tramp files." (if (file-remote-p filename) (with-parsed-tramp-file-name filename nil @@ -1486,7 +1423,7 @@ vec (format "echo \\\"`%S`\\\"" result)) "Enforcing"))))) -(defun tramp-handle-file-selinux-context (filename) +(defun tramp-sh-handle-file-selinux-context (filename) "Like `file-selinux-context' for Tramp files." (with-parsed-tramp-file-name filename nil (with-file-property v localname "file-selinux-context" @@ -1507,7 +1444,7 @@ ;; Return the context. context)))) -(defun tramp-handle-set-file-selinux-context (filename context) +(defun tramp-sh-handle-set-file-selinux-context (filename context) "Like `set-file-selinux-context' for Tramp files." (with-parsed-tramp-file-name filename nil (if (and (consp context) @@ -1530,7 +1467,7 @@ ;; Simple functions using the `test' command. -(defun tramp-handle-file-executable-p (filename) +(defun tramp-sh-handle-file-executable-p (filename) "Like `file-executable-p' for Tramp files." (with-parsed-tramp-file-name filename nil (with-file-property v localname "file-executable-p" @@ -1539,7 +1476,7 @@ (or (tramp-check-cached-permissions v ?x) (tramp-run-test "-x" filename))))) -(defun tramp-handle-file-readable-p (filename) +(defun tramp-sh-handle-file-readable-p (filename) "Like `file-readable-p' for Tramp files." (with-parsed-tramp-file-name filename nil (with-file-property v localname "file-readable-p" @@ -1553,7 +1490,7 @@ ;; expansion will also provide a `test' command which groks `-nt' (for ;; newer than). If this breaks, tell me about it and I'll try to do ;; something smarter about it. -(defun tramp-handle-file-newer-than-file-p (file1 file2) +(defun tramp-sh-handle-file-newer-than-file-p (file1 file2) "Like `file-newer-than-file-p' for Tramp files." (cond ((not (file-exists-p file1)) nil) @@ -1588,13 +1525,7 @@ ;; Functions implemented using the basic functions above. -(defun tramp-handle-file-modes (filename) - "Like `file-modes' for Tramp files." - (let ((truename (or (file-truename filename) filename))) - (when (file-exists-p truename) - (tramp-mode-string-to-int (nth 8 (file-attributes truename)))))) - -(defun tramp-handle-file-directory-p (filename) +(defun tramp-sh-handle-file-directory-p (filename) "Like `file-directory-p' for Tramp files." ;; Care must be taken that this function returns `t' for symlinks ;; pointing to directories. Surely the most obvious implementation @@ -1608,23 +1539,7 @@ (with-file-property v localname "file-directory-p" (tramp-run-test "-d" filename)))) -(defun tramp-handle-file-regular-p (filename) - "Like `file-regular-p' for Tramp files." - (and (file-exists-p filename) - (eq ?- (aref (nth 8 (file-attributes filename)) 0)))) - -(defun tramp-handle-file-symlink-p (filename) - "Like `file-symlink-p' for Tramp files." - (with-parsed-tramp-file-name filename nil - (let ((x (car (file-attributes filename)))) - (when (stringp x) - ;; When Tramp is running on VMS, then `file-name-absolute-p' - ;; might do weird things. - (if (file-name-absolute-p x) - (tramp-make-tramp-file-name method user host x) - x))))) - -(defun tramp-handle-file-writable-p (filename) +(defun tramp-sh-handle-file-writable-p (filename) "Like `file-writable-p' for Tramp files." (with-parsed-tramp-file-name filename nil (with-file-property v localname "file-writable-p" @@ -1637,7 +1552,7 @@ (and (tramp-run-test "-d" (file-name-directory filename)) (tramp-run-test "-w" (file-name-directory filename))))))) -(defun tramp-handle-file-ownership-preserved-p (filename) +(defun tramp-sh-handle-file-ownership-preserved-p (filename) "Like `file-ownership-preserved-p' for Tramp files." (with-parsed-tramp-file-name filename nil (with-file-property v localname "file-ownership-preserved-p" @@ -1647,45 +1562,9 @@ (or (null attributes) (= (nth 2 attributes) (tramp-get-remote-uid v 'integer))))))) -;; Other file name ops. - -(defun tramp-handle-directory-file-name (directory) - "Like `directory-file-name' for Tramp files." - ;; If localname component of filename is "/", leave it unchanged. - ;; Otherwise, remove any trailing slash from localname component. - ;; Method, host, etc, are unchanged. Does it make sense to try - ;; to avoid parsing the filename? - (with-parsed-tramp-file-name directory nil - (if (and (not (zerop (length localname))) - (eq (aref localname (1- (length localname))) ?/) - (not (string= localname "/"))) - (substring directory 0 -1) - directory))) - ;; Directory listings. -(defun tramp-handle-directory-files - (directory &optional full match nosort files-only) - "Like `directory-files' for Tramp files." - ;; FILES-ONLY is valid for XEmacs only. - (when (file-directory-p directory) - (setq directory (file-name-as-directory (expand-file-name directory))) - (let ((temp (nreverse (file-name-all-completions "" directory))) - result item) - - (while temp - (setq item (directory-file-name (pop temp))) - (when (and (or (null match) (string-match match item)) - (or (null files-only) - ;; Files only. - (and (equal files-only t) (file-regular-p item)) - ;; Directories only. - (file-directory-p item))) - (push (if full (concat directory item) item) - result))) - (if nosort result (sort result 'string<))))) - -(defun tramp-handle-directory-files-and-attributes +(defun tramp-sh-handle-directory-files-and-attributes (directory &optional full match nosort id-format) "Like `directory-files-and-attributes' for Tramp files." (unless id-format (setq id-format 'integer)) @@ -1760,7 +1639,7 @@ ;; This function should return "foo/" for directories and "bar" for ;; files. -(defun tramp-handle-file-name-all-completions (filename directory) +(defun tramp-sh-handle-file-name-all-completions (filename directory) "Like `file-name-all-completions' for Tramp files." (unless (save-match-data (string-match "/" filename)) (with-parsed-tramp-file-name (expand-file-name directory) nil @@ -1866,7 +1745,7 @@ (forward-line -1) (tramp-error v 'file-error - "tramp-handle-file-name-all-completions: %s" + "tramp-sh-handle-file-name-all-completions: %s" (buffer-substring (point) (tramp-compat-line-end-position)))) ;; For peace of mind, if buffer doesn't end in `fail' @@ -1877,7 +1756,7 @@ (tramp-error v 'file-error "\ -tramp-handle-file-name-all-completions: internal error accessing `%s': `%s'" +tramp-sh-handle-file-name-all-completions: internal error accessing `%s': `%s'" (tramp-shell-quote-argument localname) (buffer-string)))) (while (zerop (forward-line -1)) @@ -1903,22 +1782,9 @@ "file-name-all-completions" result)))))))) -(defun tramp-handle-file-name-completion - (filename directory &optional predicate) - "Like `file-name-completion' for Tramp files." - (unless (tramp-tramp-file-p directory) - (error - "tramp-handle-file-name-completion invoked on non-tramp directory `%s'" - directory)) - (try-completion - filename - (mapcar 'list (file-name-all-completions filename directory)) - (when predicate - (lambda (x) (funcall predicate (expand-file-name (car x) directory)))))) - ;; cp, mv and ln -(defun tramp-handle-add-name-to-file +(defun tramp-sh-handle-add-name-to-file (filename newname &optional ok-if-already-exists) "Like `add-name-to-file' for Tramp files." (unless (tramp-equal-remote filename newname) @@ -1950,7 +1816,7 @@ "error with add-name-to-file, see buffer `%s' for details" (buffer-name)))))) -(defun tramp-handle-copy-file +(defun tramp-sh-handle-copy-file (filename newname &optional ok-if-already-exists keep-date preserve-uid-gid preserve-selinux-context) "Like `copy-file' for Tramp files." @@ -1977,7 +1843,8 @@ (tramp-run-real-handler 'copy-file (list filename newname ok-if-already-exists keep-date))))) -(defun tramp-handle-copy-directory (dirname newname &optional keep-date parents) +(defun tramp-sh-handle-copy-directory + (dirname newname &optional keep-date parents) "Like `copy-directory' for Tramp files." (let ((t1 (tramp-tramp-file-p dirname)) (t2 (tramp-tramp-file-p newname))) @@ -2013,7 +1880,7 @@ (tramp-flush-file-property v (file-name-directory localname)) (tramp-flush-file-property v localname)))))) -(defun tramp-handle-rename-file +(defun tramp-sh-handle-rename-file (filename newname &optional ok-if-already-exists) "Like `rename-file' for Tramp files." ;; Check if both files are local -- invoke normal rename-file. @@ -2041,9 +1908,10 @@ the uid and gid if both files are on the same host. PRESERVE-SELINUX-CONTEXT activates selinux commands. -This function is invoked by `tramp-handle-copy-file' and -`tramp-handle-rename-file'. It is an error if OP is neither of `copy' -and `rename'. FILENAME and NEWNAME must be absolute file names." +This function is invoked by `tramp-sh-handle-copy-file' and +`tramp-sh-handle-rename-file'. It is an error if OP is neither +of `copy' and `rename'. FILENAME and NEWNAME must be absolute +file names." (unless (memq op '(copy rename)) (error "Unknown operation `%s', must be `copy' or `rename'" op)) (let ((t1 (tramp-tramp-file-p filename)) @@ -2464,7 +2332,7 @@ (delete-file filename) (tramp-compat-delete-directory filename 'recursive)))))) -(defun tramp-handle-make-directory (dir &optional parents) +(defun tramp-sh-handle-make-directory (dir &optional parents) "Like `make-directory' for Tramp files." (setq dir (expand-file-name dir)) (with-parsed-tramp-file-name dir nil @@ -2476,7 +2344,7 @@ (tramp-shell-quote-argument localname)) "Couldn't make directory %s" dir)))) -(defun tramp-handle-delete-directory (directory &optional recursive) +(defun tramp-sh-handle-delete-directory (directory &optional recursive) "Like `delete-directory' for Tramp files." (setq directory (expand-file-name directory)) (with-parsed-tramp-file-name directory nil @@ -2488,7 +2356,7 @@ (tramp-shell-quote-argument localname)) "Couldn't delete %s" directory))) -(defun tramp-handle-delete-file (filename &optional trash) +(defun tramp-sh-handle-delete-file (filename &optional trash) "Like `delete-file' for Tramp files." (setq filename (expand-file-name filename)) (with-parsed-tramp-file-name filename nil @@ -2504,7 +2372,7 @@ ;; CCC: This does not seem to be enough. Something dies when ;; we try and delete two directories under Tramp :/ -(defun tramp-handle-dired-recursive-delete-directory (filename) +(defun tramp-sh-handle-dired-recursive-delete-directory (filename) "Recursively delete the directory given. This is like `dired-recursive-delete-directory' for Tramp files." (with-parsed-tramp-file-name filename nil @@ -2528,7 +2396,7 @@ (tramp-error v 'file-error "Failed to recursively delete %s" filename)))) -(defun tramp-handle-dired-compress-file (file &rest ok-flag) +(defun tramp-sh-handle-dired-compress-file (file &rest ok-flag) "Like `dired-compress-file' for Tramp files." ;; OK-FLAG is valid for XEmacs only, but not implemented. ;; Code stolen mainly from dired-aux.el. @@ -2582,14 +2450,7 @@ (concat file ".z")) (t nil)))))))))) -(defun tramp-handle-dired-uncache (dir &optional dir-p) - "Like `dired-uncache' for Tramp files." - ;; DIR-P is valid for XEmacs only. - (with-parsed-tramp-file-name - (if (or dir-p (file-directory-p dir)) dir (file-name-directory dir)) nil - (tramp-flush-directory-property v localname))) - -(defun tramp-handle-insert-directory +(defun tramp-sh-handle-insert-directory (filename switches &optional wildcard full-directory-p) "Like `insert-directory' for Tramp files." (setq filename (expand-file-name filename)) @@ -2692,15 +2553,9 @@ (goto-char (point-max)))))) -(defun tramp-handle-unhandled-file-name-directory (filename) - "Like `unhandled-file-name-directory' for Tramp files." - ;; With Emacs 23, we could simply return `nil'. But we must keep it - ;; for backward compatibility. - (expand-file-name "~/")) - ;; Canonicalization of file names. -(defun tramp-handle-expand-file-name (name &optional dir) +(defun tramp-sh-handle-expand-file-name (name &optional dir) "Like `expand-file-name' for Tramp files. If the localname part of the given filename starts with \"/../\" then the result will be a local, non-Tramp, filename." @@ -2759,41 +2614,9 @@ (tramp-run-real-handler 'expand-file-name (list localname)))))))) -(defun tramp-handle-substitute-in-file-name (filename) - "Like `substitute-in-file-name' for Tramp files. -\"//\" and \"/~\" substitute only in the local filename part. -If the URL Tramp syntax is chosen, \"//\" as method delimeter and \"/~\" at -beginning of local filename are not substituted." - ;; First, we must replace environment variables. - (setq filename (tramp-replace-environment-variables filename)) - (with-parsed-tramp-file-name filename nil - (if (equal tramp-syntax 'url) - ;; We need to check localname only. The other parts cannot contain - ;; "//" or "/~". - (if (and (> (length localname) 1) - (or (string-match "//" localname) - (string-match "/~" localname 1))) - (tramp-run-real-handler 'substitute-in-file-name (list filename)) - (tramp-make-tramp-file-name - (when method (substitute-in-file-name method)) - (when user (substitute-in-file-name user)) - (when host (substitute-in-file-name host)) - (when localname - (tramp-run-real-handler - 'substitute-in-file-name (list localname))))) - ;; Ignore in LOCALNAME everything before "//" or "/~". - (when (and (stringp localname) (string-match ".+?/\\(/\\|~\\)" localname)) - (setq filename - (concat (file-remote-p filename) - (replace-match "\\1" nil nil localname))) - ;; "/m:h:~" does not work for completion. We use "/m:h:~/". - (when (string-match "~$" filename) - (setq filename (concat filename "/")))) - (tramp-run-real-handler 'substitute-in-file-name (list filename))))) - ;;; Remote commands: -(defun tramp-handle-executable-find (command) +(defun tramp-sh-handle-executable-find (command) "Like `executable-find' for Tramp files." (with-parsed-tramp-file-name default-directory nil (tramp-find-executable v command (tramp-get-remote-path v) t))) @@ -2809,7 +2632,7 @@ ;; We use BUFFER also as connection buffer during setup. Because of ;; this, its original contents must be saved, and restored once ;; connection has been setup. -(defun tramp-handle-start-file-process (name buffer program &rest args) +(defun tramp-sh-handle-start-file-process (name buffer program &rest args) "Like `start-file-process' for Tramp files." (with-parsed-tramp-file-name default-directory nil (unwind-protect @@ -2868,7 +2691,7 @@ (tramp-set-connection-property v "process-name" nil) (tramp-set-connection-property v "process-buffer" nil)))) -(defun tramp-handle-process-file +(defun tramp-sh-handle-process-file (program &optional infile destination display &rest args) "Like `process-file' for Tramp files." ;; The implementation is not complete yet. @@ -2981,7 +2804,7 @@ (keyboard-quit) ret)))) -(defun tramp-handle-call-process-region +(defun tramp-sh-handle-call-process-region (start end program &optional delete buffer display &rest args) "Like `call-process-region' for Tramp files." (let ((tmpfile (tramp-compat-make-temp-file ""))) @@ -2991,7 +2814,7 @@ (apply 'call-process program tmpfile buffer display args) (delete-file tmpfile)))) -(defun tramp-handle-shell-command +(defun tramp-sh-handle-shell-command (command &optional output-buffer error-buffer) "Like `shell-command' for Tramp files." (let* ((asynchronous (string-match "[ \t]*&[ \t]*\\'" command)) @@ -3072,9 +2895,8 @@ (tramp-compat-funcall 'display-message-or-buffer output-buffer) (pop-to-buffer output-buffer)))))))) -(defun tramp-handle-file-local-copy (filename) +(defun tramp-sh-handle-file-local-copy (filename) "Like `file-local-copy' for Tramp files." - (with-parsed-tramp-file-name filename nil (unless (file-exists-p filename) (tramp-error @@ -3153,131 +2975,8 @@ (run-hooks 'tramp-handle-file-local-copy-hook) tmpfile))) -(defun tramp-handle-file-remote-p (filename &optional identification connected) - "Like `file-remote-p' for Tramp files." - (let ((tramp-verbose 3)) - (when (tramp-tramp-file-p filename) - (let* ((v (tramp-dissect-file-name filename)) - (p (tramp-get-connection-process v)) - (c (and p (processp p) (memq (process-status p) '(run open))))) - ;; We expand the file name only, if there is already a connection. - (with-parsed-tramp-file-name - (if c (expand-file-name filename) filename) nil - (and (or (not connected) c) - (cond - ((eq identification 'method) method) - ((eq identification 'user) user) - ((eq identification 'host) host) - ((eq identification 'localname) localname) - (t (tramp-make-tramp-file-name method user host ""))))))))) - -(defun tramp-handle-insert-file-contents - (filename &optional visit beg end replace) - "Like `insert-file-contents' for Tramp files." - (barf-if-buffer-read-only) - (setq filename (expand-file-name filename)) - (let (result local-copy remote-copy) - (with-parsed-tramp-file-name filename nil - (unwind-protect - (if (not (file-exists-p filename)) - ;; We don't raise a Tramp error, because it might be - ;; suppressed, like in `find-file-noselect-1'. - (signal 'file-error - (list "File not found on remote host" filename)) - - (if (and (tramp-local-host-p v) - (let (file-name-handler-alist) - (file-readable-p localname))) - ;; Short track: if we are on the local host, we can - ;; run directly. - (setq result - (tramp-run-real-handler - 'insert-file-contents - (list localname visit beg end replace))) - - ;; When we shall insert only a part of the file, we copy - ;; this part. - (when (or beg end) - (setq remote-copy (tramp-make-tramp-temp-file v)) - (tramp-send-command - v - (cond - ((and beg end) - (format "tail -c +%d %s | head -c +%d >%s" - (1+ beg) (tramp-shell-quote-argument localname) - (- end beg) remote-copy)) - (beg - (format "tail -c +%d %s >%s" - (1+ beg) (tramp-shell-quote-argument localname) - remote-copy)) - (end - (format "head -c +%d %s >%s" - (1+ end) (tramp-shell-quote-argument localname) - remote-copy))))) - - ;; `insert-file-contents-literally' takes care to avoid - ;; calling jka-compr. By let-binding - ;; `inhibit-file-name-operation', we propagate that care - ;; to the `file-local-copy' operation. - (setq local-copy - (let ((inhibit-file-name-operation - (when (eq inhibit-file-name-operation - 'insert-file-contents) - 'file-local-copy))) - (cond - ((stringp remote-copy) - (file-local-copy - (tramp-make-tramp-file-name - method user host remote-copy))) - ((stringp tramp-temp-buffer-file-name) - (copy-file filename tramp-temp-buffer-file-name 'ok) - tramp-temp-buffer-file-name) - (t (file-local-copy filename))))) - - ;; When the file is not readable for the owner, it - ;; cannot be inserted, even it is redable for the group - ;; or for everybody. - (set-file-modes local-copy (tramp-compat-octal-to-decimal "0600")) - - (when (and (null remote-copy) - (tramp-get-method-parameter - method 'tramp-copy-keep-tmpfile)) - ;; We keep the local file for performance reasons, - ;; useful for "rsync". - (setq tramp-temp-buffer-file-name local-copy) - (put 'tramp-temp-buffer-file-name 'permanent-local t)) - - (with-progress-reporter - v 3 (format "Inserting local temp file `%s'" local-copy) - ;; We must ensure that `file-coding-system-alist' - ;; matches `local-copy'. - (let ((file-coding-system-alist - (tramp-find-file-name-coding-system-alist - filename local-copy))) - (setq result - (insert-file-contents - local-copy nil nil nil replace)))))) - - ;; Save exit. - (progn - (when visit - (setq buffer-file-name filename) - (setq buffer-read-only (not (file-writable-p filename))) - (set-visited-file-modtime) - (set-buffer-modified-p nil)) - (when (and (stringp local-copy) - (or remote-copy (null tramp-temp-buffer-file-name))) - (delete-file local-copy)) - (when (stringp remote-copy) - (delete-file - (tramp-make-tramp-file-name method user host remote-copy)))))) - - ;; Result. - (list (expand-file-name filename) - (cadr result)))) - ;; This is needed for XEmacs only. Code stolen from files.el. -(defun tramp-handle-insert-file-contents-literally +(defun tramp-sh-handle-insert-file-contents-literally (filename &optional visit beg end replace) "Like `insert-file-contents-literally' for Tramp files." (let ((format-alist nil) @@ -3299,49 +2998,7 @@ (fset 'find-buffer-file-type find-buffer-file-type-function) (fmakunbound 'find-buffer-file-type))))) -(defun tramp-handle-find-backup-file-name (filename) - "Like `find-backup-file-name' for Tramp files." - (with-parsed-tramp-file-name filename nil - ;; We set both variables. It doesn't matter whether it is - ;; Emacs or XEmacs. - (let ((backup-directory-alist - ;; Emacs case. - (when (boundp 'backup-directory-alist) - (if (symbol-value 'tramp-backup-directory-alist) - (mapcar - (lambda (x) - (cons - (car x) - (if (and (stringp (cdr x)) - (file-name-absolute-p (cdr x)) - (not (tramp-file-name-p (cdr x)))) - (tramp-make-tramp-file-name method user host (cdr x)) - (cdr x)))) - (symbol-value 'tramp-backup-directory-alist)) - (symbol-value 'backup-directory-alist)))) - - (bkup-backup-directory-info - ;; XEmacs case. - (when (boundp 'bkup-backup-directory-info) - (if (symbol-value 'tramp-bkup-backup-directory-info) - (mapcar - (lambda (x) - (nconc - (list (car x)) - (list - (if (and (stringp (car (cdr x))) - (file-name-absolute-p (car (cdr x))) - (not (tramp-file-name-p (car (cdr x))))) - (tramp-make-tramp-file-name - method user host (car (cdr x))) - (car (cdr x)))) - (cdr (cdr x)))) - (symbol-value 'tramp-bkup-backup-directory-info)) - (symbol-value 'bkup-backup-directory-info))))) - - (tramp-run-real-handler 'find-backup-file-name (list filename))))) - -(defun tramp-handle-make-auto-save-file-name () +(defun tramp-sh-handle-make-auto-save-file-name () "Like `make-auto-save-file-name' for Tramp files. Returns a file name in `tramp-auto-save-directory' for autosaving this file." (let ((tramp-auto-save-directory tramp-auto-save-directory) @@ -3383,11 +3040,8 @@ (tramp-run-real-handler 'make-auto-save-file-name nil) (ad-activate 'make-auto-save-file-name))))) -(defvar tramp-handle-write-region-hook nil - "Normal hook to be run at the end of `tramp-handle-write-region'.") - ;; CCC grok LOCKNAME -(defun tramp-handle-write-region +(defun tramp-sh-handle-write-region (start end filename &optional append visit lockname confirm) "Like `write-region' for Tramp files." (setq filename (expand-file-name filename)) @@ -3400,7 +3054,7 @@ ;; (unless (or (eq lockname nil) ;; (string= lockname filename)) ;; (error - ;; "tramp-handle-write-region: LOCKNAME must be nil or equal FILENAME")) + ;; "tramp-sh-handle-write-region: LOCKNAME must be nil or equal FILENAME")) ;; XEmacs takes a coding system as the seventh argument, not `confirm'. (when (and (not (featurep 'xemacs)) confirm (file-exists-p filename)) @@ -3649,7 +3303,7 @@ ;; can reset the file name handlers, and we make a second run of ;; `vc-registered', which returns the expected result without sending ;; any other remote command. -(defun tramp-handle-vc-registered (file) +(defun tramp-sh-handle-vc-registered (file) "Like `vc-registered' for Tramp files." (tramp-compat-with-temp-message "" (with-parsed-tramp-file-name file nil @@ -4791,77 +4445,6 @@ "`%s' does not return a valid Lisp expression: `%s'" command (buffer-string)))))) -(defun tramp-mode-string-to-int (mode-string) - "Converts a ten-letter `drwxrwxrwx'-style mode string into mode bits." - (let* (case-fold-search - (mode-chars (string-to-vector mode-string)) - (owner-read (aref mode-chars 1)) - (owner-write (aref mode-chars 2)) - (owner-execute-or-setid (aref mode-chars 3)) - (group-read (aref mode-chars 4)) - (group-write (aref mode-chars 5)) - (group-execute-or-setid (aref mode-chars 6)) - (other-read (aref mode-chars 7)) - (other-write (aref mode-chars 8)) - (other-execute-or-sticky (aref mode-chars 9))) - (save-match-data - (logior - (cond - ((char-equal owner-read ?r) (tramp-compat-octal-to-decimal "00400")) - ((char-equal owner-read ?-) 0) - (t (error "Second char `%c' must be one of `r-'" owner-read))) - (cond - ((char-equal owner-write ?w) (tramp-compat-octal-to-decimal "00200")) - ((char-equal owner-write ?-) 0) - (t (error "Third char `%c' must be one of `w-'" owner-write))) - (cond - ((char-equal owner-execute-or-setid ?x) - (tramp-compat-octal-to-decimal "00100")) - ((char-equal owner-execute-or-setid ?S) - (tramp-compat-octal-to-decimal "04000")) - ((char-equal owner-execute-or-setid ?s) - (tramp-compat-octal-to-decimal "04100")) - ((char-equal owner-execute-or-setid ?-) 0) - (t (error "Fourth char `%c' must be one of `xsS-'" - owner-execute-or-setid))) - (cond - ((char-equal group-read ?r) (tramp-compat-octal-to-decimal "00040")) - ((char-equal group-read ?-) 0) - (t (error "Fifth char `%c' must be one of `r-'" group-read))) - (cond - ((char-equal group-write ?w) (tramp-compat-octal-to-decimal "00020")) - ((char-equal group-write ?-) 0) - (t (error "Sixth char `%c' must be one of `w-'" group-write))) - (cond - ((char-equal group-execute-or-setid ?x) - (tramp-compat-octal-to-decimal "00010")) - ((char-equal group-execute-or-setid ?S) - (tramp-compat-octal-to-decimal "02000")) - ((char-equal group-execute-or-setid ?s) - (tramp-compat-octal-to-decimal "02010")) - ((char-equal group-execute-or-setid ?-) 0) - (t (error "Seventh char `%c' must be one of `xsS-'" - group-execute-or-setid))) - (cond - ((char-equal other-read ?r) - (tramp-compat-octal-to-decimal "00004")) - ((char-equal other-read ?-) 0) - (t (error "Eighth char `%c' must be one of `r-'" other-read))) - (cond - ((char-equal other-write ?w) (tramp-compat-octal-to-decimal "00002")) - ((char-equal other-write ?-) 0) - (t (error "Nineth char `%c' must be one of `w-'" other-write))) - (cond - ((char-equal other-execute-or-sticky ?x) - (tramp-compat-octal-to-decimal "00001")) - ((char-equal other-execute-or-sticky ?T) - (tramp-compat-octal-to-decimal "01000")) - ((char-equal other-execute-or-sticky ?t) - (tramp-compat-octal-to-decimal "01001")) - ((char-equal other-execute-or-sticky ?-) 0) - (t (error "Tenth char `%c' must be one of `xtT-'" - other-execute-or-sticky))))))) - (defun tramp-convert-file-attributes (vec attr) "Convert file-attributes ATTR generated by perl script, stat or ls. Convert file mode bits to string and set virtual device number. @@ -5024,30 +4607,6 @@ (> size tramp-copy-size-limit) (null (tramp-get-inline-coding vec "remote-encoding" size))))) -(defun tramp-local-host-p (vec) - "Return t if this points to the local host, nil otherwise." - ;; We cannot use `tramp-file-name-real-host'. A port is an - ;; indication for an ssh tunnel or alike. - (let ((host (tramp-file-name-host vec))) - (and - (stringp host) - (string-match tramp-local-host-regexp host) - ;; The method shall be applied to one of the shell file name - ;; handler. `tramp-local-host-p' is also called for "smb" and - ;; alike, where it must fail. - (tramp-get-method-parameter - (tramp-file-name-method vec) 'tramp-login-program) - ;; The local temp directory must be writable for the other user. - (file-writable-p - (tramp-make-tramp-file-name - (tramp-file-name-method vec) - (tramp-file-name-user vec) - host - (tramp-compat-temporary-file-directory))) - ;; On some systems, chown runs only for root. - (or (zerop (user-uid)) - (zerop (tramp-get-remote-uid vec 'integer)))))) - ;; Variables local to connection. (defun tramp-get-remote-path (vec) @@ -5133,33 +4692,6 @@ dir (tramp-error vec 'file-error "Directory %s not accessible" dir))))) -(defun tramp-make-tramp-temp-file (vec) - "Create a temporary file on the remote host identified by VEC. -Return the local name of the temporary file." - (let ((prefix - (tramp-make-tramp-file-name - (tramp-file-name-method vec) - (tramp-file-name-user vec) - (tramp-file-name-host vec) - (tramp-drop-volume-letter - (expand-file-name - tramp-temp-name-prefix (tramp-get-remote-tmpdir vec))))) - result) - (while (not result) - ;; `make-temp-file' would be the natural choice for - ;; implementation. But it calls `write-region' internally, - ;; which also needs a temporary file - we would end in an - ;; infinite loop. - (setq result (make-temp-name prefix)) - (if (file-exists-p result) - (setq result nil) - ;; This creates the file by side effect. - (set-file-times result) - (set-file-modes result (tramp-compat-octal-to-decimal "0700")))) - - ;; Return the local part. - (with-parsed-tramp-file-name result nil localname))) - (defun tramp-get-ls-command (vec) (with-connection-property vec "ls" (tramp-message vec 5 "Finding a suitable `ls' command") === modified file 'lisp/net/tramp-smb.el' --- lisp/net/tramp-smb.el 2010-09-13 15:17:01 +0000 +++ lisp/net/tramp-smb.el 2010-10-04 19:44:08 +0000 @@ -31,10 +31,6 @@ (eval-when-compile (require 'cl)) ; block, return (require 'tramp) -;; We call several `tramp-handle-*' functions directly. So we must -;; reqire that package as well. -(require 'tramp-sh) - ;; Define SMB method ... ;;;###tramp-autoload (defconst tramp-smb-method "smb" === modified file 'lisp/net/tramp.el' --- lisp/net/tramp.el 2010-10-02 13:21:43 +0000 +++ lisp/net/tramp.el 2010-10-04 19:44:08 +0000 @@ -761,7 +761,7 @@ (defconst tramp-localname-regexp ".*$" "*Regexp matching localnames.") -;; File name format. +;;; File name format: (defconst tramp-file-name-structure (list @@ -1009,10 +1009,6 @@ ;;; Internal functions which must come first: - -;; ------------------------------------------------------------ -;; -- Tramp file names -- -;; ------------------------------------------------------------ ;; Conversion functions between external representation and ;; internal data structure. Convenience functions for internal ;; data structure. @@ -1658,9 +1654,6 @@ '(minibuffer-electric-separator minibuffer-electric-tilde))) -(defvar tramp-handle-file-local-copy-hook nil - "Normal hook to be run at the end of `tramp-handle-file-local-copy'.") - (defun tramp-find-file-name-coding-system-alist (filename tmpname) "Like `find-operation-coding-system' for Tramp filenames. Tramp's `insert-file-contents' and `write-region' work over @@ -1952,9 +1945,29 @@ ;; `tramp-file-name-handler' must be registered before evaluation of ;; site-start and init files, because there might exist remote files ;; already, f.e. files kept via recentf-mode. -;;;###autoload(tramp-register-file-name-handlers) +;;;###autoload (tramp-register-file-name-handlers) +(defun tramp-exists-file-name-handler (operation &rest args) + "Check, whether OPERATION runs a file name handler." + ;; The file name handler is determined on base of either an + ;; argument, `buffer-file-name', or `default-directory'. + (ignore-errors + (let* ((buffer-file-name "/") + (default-directory "/") + (fnha file-name-handler-alist) + (check-file-name-operation operation) + (file-name-handler-alist + (list + (cons "/" + (lambda (operation &rest args) + "Returns OPERATION if it is the one to be checked." + (if (equal check-file-name-operation operation) + operation + (let ((file-name-handler-alist fnha)) + (apply operation args)))))))) + (equal (apply operation args) operation)))) + ;;;###autoload (defun tramp-unload-file-name-handlers () (setq file-name-handler-alist @@ -2554,20 +2567,360 @@ (forward-line 1) result)) -(defun tramp-delete-temp-file-function () - "Remove temporary files related to current buffer." - (when (stringp tramp-temp-buffer-file-name) - (ignore-errors (delete-file tramp-temp-buffer-file-name)))) - -(add-hook 'kill-buffer-hook 'tramp-delete-temp-file-function) -(add-hook 'tramp-cache-unload-hook - (lambda () - (remove-hook 'kill-buffer-hook - 'tramp-delete-temp-file-function))) - -;; ------------------------------------------------------------ -;; -- Functions for establishing connection -- -;; ------------------------------------------------------------ +;;; Common file name handler functions for different backends: + +(defvar tramp-handle-file-local-copy-hook nil + "Normal hook to be run at the end of `tramp-*-handle-file-local-copy'.") + +(defvar tramp-handle-write-region-hook nil + "Normal hook to be run at the end of `tramp-*-handle-write-region'.") + +(defun tramp-handle-directory-file-name (directory) + "Like `directory-file-name' for Tramp files." + ;; If localname component of filename is "/", leave it unchanged. + ;; Otherwise, remove any trailing slash from localname component. + ;; Method, host, etc, are unchanged. Does it make sense to try + ;; to avoid parsing the filename? + (with-parsed-tramp-file-name directory nil + (if (and (not (zerop (length localname))) + (eq (aref localname (1- (length localname))) ?/) + (not (string= localname "/"))) + (substring directory 0 -1) + directory))) + +(defun tramp-handle-directory-files + (directory &optional full match nosort files-only) + "Like `directory-files' for Tramp files." + ;; FILES-ONLY is valid for XEmacs only. + (when (file-directory-p directory) + (setq directory (file-name-as-directory (expand-file-name directory))) + (let ((temp (nreverse (file-name-all-completions "" directory))) + result item) + + (while temp + (setq item (directory-file-name (pop temp))) + (when (and (or (null match) (string-match match item)) + (or (null files-only) + ;; Files only. + (and (equal files-only t) (file-regular-p item)) + ;; Directories only. + (file-directory-p item))) + (push (if full (concat directory item) item) + result))) + (if nosort result (sort result 'string<))))) + +(defun tramp-handle-dired-uncache (dir &optional dir-p) + "Like `dired-uncache' for Tramp files." + ;; DIR-P is valid for XEmacs only. + (with-parsed-tramp-file-name + (if (or dir-p (file-directory-p dir)) dir (file-name-directory dir)) nil + (tramp-flush-directory-property v localname))) + +(defun tramp-handle-file-modes (filename) + "Like `file-modes' for Tramp files." + (let ((truename (or (file-truename filename) filename))) + (when (file-exists-p truename) + (tramp-mode-string-to-int (nth 8 (file-attributes truename)))))) + +;; Localname manipulation functions that grok Tramp localnames... +(defun tramp-handle-file-name-as-directory (file) + "Like `file-name-as-directory' but aware of Tramp files." + ;; `file-name-as-directory' would be sufficient except localname is + ;; the empty string. + (let ((v (tramp-dissect-file-name file t))) + ;; Run the command on the localname portion only. + (tramp-make-tramp-file-name + (tramp-file-name-method v) + (tramp-file-name-user v) + (tramp-file-name-host v) + (tramp-run-real-handler + 'file-name-as-directory (list (or (tramp-file-name-localname v) "")))))) + +(defun tramp-handle-file-name-completion + (filename directory &optional predicate) + "Like `file-name-completion' for Tramp files." + (unless (tramp-tramp-file-p directory) + (error + "tramp-handle-file-name-completion invoked on non-tramp directory `%s'" + directory)) + (try-completion + filename + (mapcar 'list (file-name-all-completions filename directory)) + (when predicate + (lambda (x) (funcall predicate (expand-file-name (car x) directory)))))) + +(defun tramp-handle-file-name-directory (file) + "Like `file-name-directory' but aware of Tramp files." + ;; Everything except the last filename thing is the directory. We + ;; cannot apply `with-parsed-tramp-file-name', because this expands + ;; the remote file name parts. This is a problem when we are in + ;; file name completion. + (let ((v (tramp-dissect-file-name file t))) + ;; Run the command on the localname portion only. + (tramp-make-tramp-file-name + (tramp-file-name-method v) + (tramp-file-name-user v) + (tramp-file-name-host v) + (tramp-run-real-handler + 'file-name-directory (list (or (tramp-file-name-localname v) "")))))) + +(defun tramp-handle-file-name-nondirectory (file) + "Like `file-name-nondirectory' but aware of Tramp files." + (with-parsed-tramp-file-name file nil + (tramp-run-real-handler 'file-name-nondirectory (list localname)))) + +(defun tramp-handle-file-regular-p (filename) + "Like `file-regular-p' for Tramp files." + (and (file-exists-p filename) + (eq ?- (aref (nth 8 (file-attributes filename)) 0)))) + +(defun tramp-handle-file-remote-p (filename &optional identification connected) + "Like `file-remote-p' for Tramp files." + (let ((tramp-verbose 3)) + (when (tramp-tramp-file-p filename) + (let* ((v (tramp-dissect-file-name filename)) + (p (tramp-get-connection-process v)) + (c (and p (processp p) (memq (process-status p) '(run open))))) + ;; We expand the file name only, if there is already a connection. + (with-parsed-tramp-file-name + (if c (expand-file-name filename) filename) nil + (and (or (not connected) c) + (cond + ((eq identification 'method) method) + ((eq identification 'user) user) + ((eq identification 'host) host) + ((eq identification 'localname) localname) + (t (tramp-make-tramp-file-name method user host ""))))))))) + +(defun tramp-handle-file-symlink-p (filename) + "Like `file-symlink-p' for Tramp files." + (with-parsed-tramp-file-name filename nil + (let ((x (car (file-attributes filename)))) + (when (stringp x) + ;; When Tramp is running on VMS, then `file-name-absolute-p' + ;; might do weird things. + (if (file-name-absolute-p x) + (tramp-make-tramp-file-name method user host x) + x))))) + +(defun tramp-handle-find-backup-file-name (filename) + "Like `find-backup-file-name' for Tramp files." + (with-parsed-tramp-file-name filename nil + ;; We set both variables. It doesn't matter whether it is + ;; Emacs or XEmacs. + (let ((backup-directory-alist + ;; Emacs case. + (when (boundp 'backup-directory-alist) + (if (symbol-value 'tramp-backup-directory-alist) + (mapcar + (lambda (x) + (cons + (car x) + (if (and (stringp (cdr x)) + (file-name-absolute-p (cdr x)) + (not (tramp-file-name-p (cdr x)))) + (tramp-make-tramp-file-name method user host (cdr x)) + (cdr x)))) + (symbol-value 'tramp-backup-directory-alist)) + (symbol-value 'backup-directory-alist)))) + + (bkup-backup-directory-info + ;; XEmacs case. + (when (boundp 'bkup-backup-directory-info) + (if (symbol-value 'tramp-bkup-backup-directory-info) + (mapcar + (lambda (x) + (nconc + (list (car x)) + (list + (if (and (stringp (car (cdr x))) + (file-name-absolute-p (car (cdr x))) + (not (tramp-file-name-p (car (cdr x))))) + (tramp-make-tramp-file-name + method user host (car (cdr x))) + (car (cdr x)))) + (cdr (cdr x)))) + (symbol-value 'tramp-bkup-backup-directory-info)) + (symbol-value 'bkup-backup-directory-info))))) + + (tramp-run-real-handler 'find-backup-file-name (list filename))))) + +(defun tramp-handle-insert-file-contents + (filename &optional visit beg end replace) + "Like `insert-file-contents' for Tramp files." + (barf-if-buffer-read-only) + (setq filename (expand-file-name filename)) + (let (result local-copy remote-copy) + (with-parsed-tramp-file-name filename nil + (unwind-protect + (if (not (file-exists-p filename)) + ;; We don't raise a Tramp error, because it might be + ;; suppressed, like in `find-file-noselect-1'. + (signal 'file-error + (list "File not found on remote host" filename)) + + (if (and (tramp-local-host-p v) + (let (file-name-handler-alist) + (file-readable-p localname))) + ;; Short track: if we are on the local host, we can + ;; run directly. + (setq result + (tramp-run-real-handler + 'insert-file-contents + (list localname visit beg end replace))) + + ;; When we shall insert only a part of the file, we copy + ;; this part. + (when (or beg end) + (setq remote-copy (tramp-make-tramp-temp-file v)) + ;; This is defined in tramp-sh.el. Let's assume this + ;; is loaded already. + (tramp-compat-funcall 'tramp-send-command + v + (cond + ((and beg end) + (format "tail -c +%d %s | head -c +%d >%s" + (1+ beg) (tramp-shell-quote-argument localname) + (- end beg) remote-copy)) + (beg + (format "tail -c +%d %s >%s" + (1+ beg) (tramp-shell-quote-argument localname) + remote-copy)) + (end + (format "head -c +%d %s >%s" + (1+ end) (tramp-shell-quote-argument localname) + remote-copy))))) + + ;; `insert-file-contents-literally' takes care to avoid + ;; calling jka-compr. By let-binding + ;; `inhibit-file-name-operation', we propagate that care + ;; to the `file-local-copy' operation. + (setq local-copy + (let ((inhibit-file-name-operation + (when (eq inhibit-file-name-operation + 'insert-file-contents) + 'file-local-copy))) + (cond + ((stringp remote-copy) + (file-local-copy + (tramp-make-tramp-file-name + method user host remote-copy))) + ((stringp tramp-temp-buffer-file-name) + (copy-file filename tramp-temp-buffer-file-name 'ok) + tramp-temp-buffer-file-name) + (t (file-local-copy filename))))) + + ;; When the file is not readable for the owner, it + ;; cannot be inserted, even it is redable for the group + ;; or for everybody. + (set-file-modes local-copy (tramp-compat-octal-to-decimal "0600")) + + (when (and (null remote-copy) + (tramp-get-method-parameter + method 'tramp-copy-keep-tmpfile)) + ;; We keep the local file for performance reasons, + ;; useful for "rsync". + (setq tramp-temp-buffer-file-name local-copy) + (put 'tramp-temp-buffer-file-name 'permanent-local t)) + + (with-progress-reporter + v 3 (format "Inserting local temp file `%s'" local-copy) + ;; We must ensure that `file-coding-system-alist' + ;; matches `local-copy'. + (let ((file-coding-system-alist + (tramp-find-file-name-coding-system-alist + filename local-copy))) + (setq result + (insert-file-contents + local-copy nil nil nil replace)))))) + + ;; Save exit. + (progn + (when visit + (setq buffer-file-name filename) + (setq buffer-read-only (not (file-writable-p filename))) + (set-visited-file-modtime) + (set-buffer-modified-p nil)) + (when (and (stringp local-copy) + (or remote-copy (null tramp-temp-buffer-file-name))) + (delete-file local-copy)) + (when (stringp remote-copy) + (delete-file + (tramp-make-tramp-file-name method user host remote-copy)))))) + + ;; Result. + (list (expand-file-name filename) + (cadr result)))) + +(defun tramp-handle-load (file &optional noerror nomessage nosuffix must-suffix) + "Like `load' for Tramp files." + (with-parsed-tramp-file-name (expand-file-name file) nil + (unless nosuffix + (cond ((file-exists-p (concat file ".elc")) + (setq file (concat file ".elc"))) + ((file-exists-p (concat file ".el")) + (setq file (concat file ".el"))))) + (when must-suffix + ;; The first condition is always true for absolute file names. + ;; Included for safety's sake. + (unless (or (file-name-directory file) + (string-match "\\.elc?\\'" file)) + (tramp-error + v 'file-error + "File `%s' does not include a `.el' or `.elc' suffix" file))) + (unless noerror + (when (not (file-exists-p file)) + (tramp-error v 'file-error "Cannot load nonexistent file `%s'" file))) + (if (not (file-exists-p file)) + nil + (let ((tramp-message-show-message (not nomessage))) + (with-progress-reporter v 0 (format "Loading %s" file) + (let ((local-copy (file-local-copy file))) + ;; MUST-SUFFIX doesn't exist on XEmacs, so let it default to nil. + (unwind-protect + (load local-copy noerror t t) + (delete-file local-copy))))) + t))) + +(defun tramp-handle-substitute-in-file-name (filename) + "Like `substitute-in-file-name' for Tramp files. +\"//\" and \"/~\" substitute only in the local filename part. +If the URL Tramp syntax is chosen, \"//\" as method delimeter and \"/~\" at +beginning of local filename are not substituted." + ;; First, we must replace environment variables. + (setq filename (tramp-replace-environment-variables filename)) + (with-parsed-tramp-file-name filename nil + (if (equal tramp-syntax 'url) + ;; We need to check localname only. The other parts cannot contain + ;; "//" or "/~". + (if (and (> (length localname) 1) + (or (string-match "//" localname) + (string-match "/~" localname 1))) + (tramp-run-real-handler 'substitute-in-file-name (list filename)) + (tramp-make-tramp-file-name + (when method (substitute-in-file-name method)) + (when user (substitute-in-file-name user)) + (when host (substitute-in-file-name host)) + (when localname + (tramp-run-real-handler + 'substitute-in-file-name (list localname))))) + ;; Ignore in LOCALNAME everything before "//" or "/~". + (when (and (stringp localname) (string-match ".+?/\\(/\\|~\\)" localname)) + (setq filename + (concat (file-remote-p filename) + (replace-match "\\1" nil nil localname))) + ;; "/m:h:~" does not work for completion. We use "/m:h:~/". + (when (string-match "~$" filename) + (setq filename (concat filename "/")))) + (tramp-run-real-handler 'substitute-in-file-name (list filename))))) + +(defun tramp-handle-unhandled-file-name-directory (filename) + "Like `unhandled-file-name-directory' for Tramp files." + ;; With Emacs 23, we could simply return `nil'. But we must keep it + ;; for backward compatibility. + (expand-file-name "~/")) + +;;; Functions for establishing connection: ;; The following functions are actions to be taken when seeing certain ;; prompts from the remote host. See the variable @@ -2666,7 +3019,7 @@ (throw 'tramp-action 'process-died)))) (t nil))) -;; Functions for processing the actions. +;;; Functions for processing the actions: (defun tramp-process-one-action (proc vec actions) "Wait for output from the shell and perform one action." @@ -2714,7 +3067,7 @@ ((eq exit 'process-died) "Process died") (t "Login failed"))))))) -;; Utility functions. +:;; Utility functions: (defun tramp-accept-process-output (&optional proc timeout timeout-msecs) "Like `accept-process-output' for Tramp processes. @@ -2902,27 +3255,145 @@ (let ((entry (assoc param (assoc method tramp-methods)))) (when entry (cadr entry)))) -;; Auto saving to a special directory. - -(defun tramp-exists-file-name-handler (operation &rest args) - "Check, whether OPERATION runs a file name handler." - ;; The file name handler is determined on base of either an - ;; argument, `buffer-file-name', or `default-directory'. - (ignore-errors - (let* ((buffer-file-name "/") - (default-directory "/") - (fnha file-name-handler-alist) - (check-file-name-operation operation) - (file-name-handler-alist - (list - (cons "/" - (lambda (operation &rest args) - "Returns OPERATION if it is the one to be checked." - (if (equal check-file-name-operation operation) - operation - (let ((file-name-handler-alist fnha)) - (apply operation args)))))))) - (equal (apply operation args) operation)))) +(defun tramp-mode-string-to-int (mode-string) + "Converts a ten-letter `drwxrwxrwx'-style mode string into mode bits." + (let* (case-fold-search + (mode-chars (string-to-vector mode-string)) + (owner-read (aref mode-chars 1)) + (owner-write (aref mode-chars 2)) + (owner-execute-or-setid (aref mode-chars 3)) + (group-read (aref mode-chars 4)) + (group-write (aref mode-chars 5)) + (group-execute-or-setid (aref mode-chars 6)) + (other-read (aref mode-chars 7)) + (other-write (aref mode-chars 8)) + (other-execute-or-sticky (aref mode-chars 9))) + (save-match-data + (logior + (cond + ((char-equal owner-read ?r) (tramp-compat-octal-to-decimal "00400")) + ((char-equal owner-read ?-) 0) + (t (error "Second char `%c' must be one of `r-'" owner-read))) + (cond + ((char-equal owner-write ?w) (tramp-compat-octal-to-decimal "00200")) + ((char-equal owner-write ?-) 0) + (t (error "Third char `%c' must be one of `w-'" owner-write))) + (cond + ((char-equal owner-execute-or-setid ?x) + (tramp-compat-octal-to-decimal "00100")) + ((char-equal owner-execute-or-setid ?S) + (tramp-compat-octal-to-decimal "04000")) + ((char-equal owner-execute-or-setid ?s) + (tramp-compat-octal-to-decimal "04100")) + ((char-equal owner-execute-or-setid ?-) 0) + (t (error "Fourth char `%c' must be one of `xsS-'" + owner-execute-or-setid))) + (cond + ((char-equal group-read ?r) (tramp-compat-octal-to-decimal "00040")) + ((char-equal group-read ?-) 0) + (t (error "Fifth char `%c' must be one of `r-'" group-read))) + (cond + ((char-equal group-write ?w) (tramp-compat-octal-to-decimal "00020")) + ((char-equal group-write ?-) 0) + (t (error "Sixth char `%c' must be one of `w-'" group-write))) + (cond + ((char-equal group-execute-or-setid ?x) + (tramp-compat-octal-to-decimal "00010")) + ((char-equal group-execute-or-setid ?S) + (tramp-compat-octal-to-decimal "02000")) + ((char-equal group-execute-or-setid ?s) + (tramp-compat-octal-to-decimal "02010")) + ((char-equal group-execute-or-setid ?-) 0) + (t (error "Seventh char `%c' must be one of `xsS-'" + group-execute-or-setid))) + (cond + ((char-equal other-read ?r) + (tramp-compat-octal-to-decimal "00004")) + ((char-equal other-read ?-) 0) + (t (error "Eighth char `%c' must be one of `r-'" other-read))) + (cond + ((char-equal other-write ?w) (tramp-compat-octal-to-decimal "00002")) + ((char-equal other-write ?-) 0) + (t (error "Nineth char `%c' must be one of `w-'" other-write))) + (cond + ((char-equal other-execute-or-sticky ?x) + (tramp-compat-octal-to-decimal "00001")) + ((char-equal other-execute-or-sticky ?T) + (tramp-compat-octal-to-decimal "01000")) + ((char-equal other-execute-or-sticky ?t) + (tramp-compat-octal-to-decimal "01001")) + ((char-equal other-execute-or-sticky ?-) 0) + (t (error "Tenth char `%c' must be one of `xtT-'" + other-execute-or-sticky))))))) + +(defun tramp-local-host-p (vec) + "Return t if this points to the local host, nil otherwise." + ;; We cannot use `tramp-file-name-real-host'. A port is an + ;; indication for an ssh tunnel or alike. + (let ((host (tramp-file-name-host vec))) + (and + (stringp host) + (string-match tramp-local-host-regexp host) + ;; The method shall be applied to one of the shell file name + ;; handler. `tramp-local-host-p' is also called for "smb" and + ;; alike, where it must fail. + (tramp-get-method-parameter + (tramp-file-name-method vec) 'tramp-login-program) + ;; The local temp directory must be writable for the other user. + (file-writable-p + (tramp-make-tramp-file-name + (tramp-file-name-method vec) + (tramp-file-name-user vec) + host + (tramp-compat-temporary-file-directory))) + ;; On some systems, chown runs only for root. + (or (zerop (user-uid)) + ;; This is defined in tramp-sh.el. Let's assume this is + ;; loaded already. + (zerop (tramp-compat-funcall 'tramp-get-remote-uid vec 'integer)))))) + +(defun tramp-make-tramp-temp-file (vec) + "Create a temporary file on the remote host identified by VEC. +Return the local name of the temporary file." + (let ((prefix + (tramp-make-tramp-file-name + (tramp-file-name-method vec) + (tramp-file-name-user vec) + (tramp-file-name-host vec) + (tramp-drop-volume-letter + (expand-file-name + tramp-temp-name-prefix + ;; This is defined in tramp-sh.el. Let's assume this is + ;; loaded already. + (tramp-compat-funcall 'tramp-get-remote-tmpdir vec))))) + result) + (while (not result) + ;; `make-temp-file' would be the natural choice for + ;; implementation. But it calls `write-region' internally, + ;; which also needs a temporary file - we would end in an + ;; infinite loop. + (setq result (make-temp-name prefix)) + (if (file-exists-p result) + (setq result nil) + ;; This creates the file by side effect. + (set-file-times result) + (set-file-modes result (tramp-compat-octal-to-decimal "0700")))) + + ;; Return the local part. + (with-parsed-tramp-file-name result nil localname))) + +(defun tramp-delete-temp-file-function () + "Remove temporary files related to current buffer." + (when (stringp tramp-temp-buffer-file-name) + (ignore-errors (delete-file tramp-temp-buffer-file-name)))) + +(add-hook 'kill-buffer-hook 'tramp-delete-temp-file-function) +(add-hook 'tramp-cache-unload-hook + (lambda () + (remove-hook 'kill-buffer-hook + 'tramp-delete-temp-file-function))) + +;;; Auto saving to a special directory: (unless (tramp-exists-file-name-handler 'make-auto-save-file-name) (defadvice make-auto-save-file-name @@ -2982,9 +3453,7 @@ (setq alist (cdr alist)))) string)) -;; ------------------------------------------------------------ -;; -- Compatibility functions section -- -;; ------------------------------------------------------------ +;;; Compatibility functions section: (defun tramp-read-passwd (proc &optional prompt) "Read a password from user (compat function). @@ -3108,11 +3577,6 @@ (tramp-compat-funcall 'set-process-query-on-exit-flag process flag) (tramp-compat-funcall 'process-kill-without-query process flag))) - -;; ------------------------------------------------------------ -;; -- Kludges section -- -;; ------------------------------------------------------------ - ;; Currently (as of Emacs 20.5), the function `shell-quote-argument' ;; does not deal well with newline characters. Newline is replaced by ;; backslash newline. But if, say, the string `a backslash newline b' ------------------------------------------------------------ revno: 101789 committer: Lars Magne Ingebrigtsen branch nick: trunk timestamp: Mon 2010-10-04 21:34:35 +0200 message: (url-http-wait-for-headers-change-function): Revert previous change. It lead to really slow loads. diff: === modified file 'lisp/url/ChangeLog' --- lisp/url/ChangeLog 2010-10-04 19:05:53 +0000 +++ lisp/url/ChangeLog 2010-10-04 19:34:35 +0000 @@ -2,6 +2,8 @@ * url-http.el (url-http-wait-for-headers-change-function): Protect against url-http-response-status for degenerate documents. + (url-http-wait-for-headers-change-function): Revert previous + change. It lead to really slow loads. 2010-10-03 Glenn Morris === modified file 'lisp/url/url-http.el' --- lisp/url/url-http.el 2010-10-04 19:05:53 +0000 +++ lisp/url/url-http.el 2010-10-04 19:34:35 +0000 @@ -1054,8 +1054,7 @@ end-of-headers t) (url-http-clean-headers))) - (if (or (not end-of-headers) - (not url-http-response-status)) + (if (not end-of-headers) ;; Haven't seen the end of the headers yet, need to wait ;; for more data to arrive. nil ------------------------------------------------------------ revno: 101788 committer: Lars Magne Ingebrigtsen branch nick: trunk timestamp: Mon 2010-10-04 21:05:53 +0200 message: * url-http.el (url-http-wait-for-headers-change-function): Protect against url-http-response-status for degenerate documents. diff: === modified file 'lisp/url/ChangeLog' --- lisp/url/ChangeLog 2010-10-03 21:37:41 +0000 +++ lisp/url/ChangeLog 2010-10-04 19:05:53 +0000 @@ -1,3 +1,8 @@ +2010-10-04 Lars Magne Ingebrigtsen + + * url-http.el (url-http-wait-for-headers-change-function): Protect + against url-http-response-status for degenerate documents. + 2010-10-03 Glenn Morris * url-util.el (url-get-url-filename-chars): Don't eval-and-compile. === modified file 'lisp/url/url-http.el' --- lisp/url/url-http.el 2010-10-03 01:30:51 +0000 +++ lisp/url/url-http.el 2010-10-04 19:05:53 +0000 @@ -1054,7 +1054,8 @@ end-of-headers t) (url-http-clean-headers))) - (if (not end-of-headers) + (if (or (not end-of-headers) + (not url-http-response-status)) ;; Haven't seen the end of the headers yet, need to wait ;; for more data to arrive. nil ------------------------------------------------------------ revno: 101787 committer: Chong Yidong branch nick: trunk timestamp: Mon 2010-10-04 14:16:22 -0400 message: Don't add an echo dash for the first keystroke (Bug#7137). * src/keyboard.c (echo_prompt): Function moved into read_key_sequence. (read_key_sequence): Inline echo_prompt. (echo_dash): Add a dash only if key is continued (Bug#7137). diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2010-10-04 17:22:57 +0000 +++ src/ChangeLog 2010-10-04 18:16:22 +0000 @@ -1,3 +1,9 @@ +2010-10-04 Chong Yidong + + * keyboard.c (echo_prompt): Function moved into read_key_sequence. + (read_key_sequence): Inline echo_prompt. + (echo_dash): Add a dash only if key is continued (Bug#7137). + 2010-10-04 Dan Nicolaescu Remove O_RDONLY, O_WRONLY definitions, not needed. === modified file 'src/keyboard.c' --- src/keyboard.c 2010-10-03 15:19:34 +0000 +++ src/keyboard.c 2010-10-04 18:16:22 +0000 @@ -645,18 +645,6 @@ static int cannot_suspend; -/* Install the string STR as the beginning of the string of echoing, - so that it serves as a prompt for the next character. - Also start echoing. */ - -void -echo_prompt (Lisp_Object str) -{ - current_kboard->echo_string = str; - current_kboard->echo_after_prompt = SCHARS (str); - echo_now (); -} - /* Add C to the echo string, if echoing is going on. C can be a character, which is printed prettily ("M-C-x" and all that jazz), or a symbol, whose name is printed. */ @@ -755,6 +743,9 @@ if (NILP (current_kboard->echo_string)) return; + if (this_command_key_count == 0) + return; + if (!current_kboard->immediate_echo && SCHARS (current_kboard->echo_string) == 0) return; @@ -9125,7 +9116,14 @@ if (INTERACTIVE) { if (!NILP (prompt)) - echo_prompt (prompt); + { + /* Install the string STR as the beginning of the string of + echoing, so that it serves as a prompt for the next + character. */ + current_kboard->echo_string = prompt; + current_kboard->echo_after_prompt = SCHARS (prompt); + echo_now (); + } else if (cursor_in_echo_area && (FLOATP (Vecho_keystrokes) || INTEGERP (Vecho_keystrokes)) && NILP (Fzerop (Vecho_keystrokes))) ------------------------------------------------------------ revno: 101786 committer: Dan Nicolaescu branch nick: trunk timestamp: Mon 2010-10-04 10:22:57 -0700 message: Remove O_RDONLY, O_WRONLY definitions, not needed. * src/unexcoff.c: * src/lread.c: * src/fileio.c: * src/doc.c: * src/callproc.c: * src/alloc.c: * src/termcap.c: Remove O_RDONLY O_WRONLY definitions. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2010-10-03 22:37:37 +0000 +++ src/ChangeLog 2010-10-04 17:22:57 +0000 @@ -1,3 +1,14 @@ +2010-10-04 Dan Nicolaescu + + Remove O_RDONLY, O_WRONLY definitions, not needed. + * unexcoff.c: + * lread.c: + * fileio.c: + * doc.c: + * callproc.c: + * alloc.c: + * termcap.c: Remove O_RDONLY O_WRONLY definitions. + 2010-10-03 Teodor Zlatanov * gnutls.h (GNUTLS_LOG2): Convenience macro. === modified file 'src/alloc.c' --- src/alloc.c 2010-10-03 15:19:34 +0000 +++ src/alloc.c 2010-10-04 17:22:57 +0000 @@ -66,9 +66,6 @@ #endif #include -#ifndef O_WRONLY -#define O_WRONLY 1 -#endif #ifdef WINDOWSNT #include "w32.h" === modified file 'src/callproc.c' --- src/callproc.c 2010-10-03 15:19:34 +0000 +++ src/callproc.c 2010-10-04 17:22:57 +0000 @@ -45,14 +45,6 @@ #include #endif /* MSDOS */ -#ifndef O_RDONLY -#define O_RDONLY 0 -#endif - -#ifndef O_WRONLY -#define O_WRONLY 1 -#endif - #include "lisp.h" #include "commands.h" #include "buffer.h" === modified file 'src/doc.c' --- src/doc.c 2010-10-03 15:19:34 +0000 +++ src/doc.c 2010-10-04 17:22:57 +0000 @@ -31,10 +31,6 @@ #include #endif -#ifndef O_RDONLY -#define O_RDONLY 0 -#endif - #include "lisp.h" #include "buffer.h" #include "keyboard.h" === modified file 'src/fileio.c' --- src/fileio.c 2010-10-03 21:27:04 +0000 +++ src/fileio.c 2010-10-04 17:22:57 +0000 @@ -100,14 +100,6 @@ #include "commands.h" -#ifndef O_WRONLY -#define O_WRONLY 1 -#endif - -#ifndef O_RDONLY -#define O_RDONLY 0 -#endif - #ifndef S_ISLNK # define lstat stat #endif === modified file 'src/lread.c' --- src/lread.c 2010-10-03 15:19:34 +0000 +++ src/lread.c 2010-10-04 17:22:57 +0000 @@ -55,9 +55,6 @@ #endif /* HAVE_SETLOCALE */ #include -#ifndef O_RDONLY -#define O_RDONLY 0 -#endif #ifdef HAVE_FSEEKO #define file_offset off_t === modified file 'src/termcap.c' --- src/termcap.c 2010-10-03 15:19:34 +0000 +++ src/termcap.c 2010-10-04 17:22:57 +0000 @@ -20,22 +20,18 @@ /* Emacs config.h may rename various library functions such as malloc. */ #include #include -#include /* xmalloc is here */ -/* Get the O_* definitions for open et al. */ #include #include #ifdef HAVE_UNISTD_H #include #endif +#include "lisp.h" + #ifndef NULL #define NULL (char *) 0 #endif -#ifndef O_RDONLY -#define O_RDONLY 0 -#endif - /* BUFSIZE is the initial size allocated for the buffer for reading the termcap file. It is not a limit. === modified file 'src/unexcoff.c' --- src/unexcoff.c 2010-10-03 13:59:56 +0000 +++ src/unexcoff.c 2010-10-04 17:22:57 +0000 @@ -97,14 +97,6 @@ #include -#ifndef O_RDONLY -#define O_RDONLY 0 -#endif -#ifndef O_RDWR -#define O_RDWR 2 -#endif - - extern char *start_of_data (void); /* Start of initialized data */ static long block_copy_start; /* Old executable start point */ ------------------------------------------------------------ revno: 101785 author: Lars Magne Ingebrigtsen committer: Katsumi Yamaoka branch nick: trunk timestamp: Mon 2010-10-04 13:17:48 +0000 message: shr.el (shr-tag-li): Get
  • indentation right. shr.el (shr-tag-li): Get
  • indentation even righter. shr.el (shr-tag-blockquote): Ensure paragraph start. diff: === modified file 'lisp/gnus/ChangeLog' --- lisp/gnus/ChangeLog 2010-10-04 10:43:14 +0000 +++ lisp/gnus/ChangeLog 2010-10-04 13:17:48 +0000 @@ -3,6 +3,9 @@ * shr.el (shr-ensure-paragraph): Fix the non-empty line case. (shr-insert): Tweak line breaking. (shr-insert): Handle
     better.
    +	(shr-tag-li): Get 
  • indentation right. + (shr-tag-li): Get
  • indentation even righter. + (shr-tag-blockquote): Ensure paragraph start. 2010-10-04 Julien Danjou === modified file 'lisp/gnus/shr.el' --- lisp/gnus/shr.el 2010-10-04 10:43:14 +0000 +++ lisp/gnus/shr.el 2010-10-04 13:17:48 +0000 @@ -220,6 +220,7 @@ (shr-ensure-newline))) (defun shr-tag-blockquote (cont) + (shr-ensure-paragraph) (let ((shr-indentation (+ shr-indentation 4))) (shr-generic cont))) @@ -289,12 +290,15 @@ (defun shr-tag-li (cont) (shr-ensure-newline) - (if (numberp shr-list-mode) - (progn - (insert (format "%d " shr-list-mode)) - (setq shr-list-mode (1+ shr-list-mode))) - (insert "* ")) - (shr-generic cont)) + (let* ((bullet + (if (numberp shr-list-mode) + (prog1 + (format "%d " shr-list-mode) + (setq shr-list-mode (1+ shr-list-mode))) + "* ")) + (shr-indentation (+ shr-indentation (length bullet)))) + (insert bullet) + (shr-generic cont))) (defun shr-tag-br (cont) (unless (bobp) ------------------------------------------------------------ revno: 101784 author: Lars Magne Ingebrigtsen committer: Katsumi Yamaoka branch nick: trunk timestamp: Mon 2010-10-04 10:43:14 +0000 message: shr.el (shr-insert): Tweak line breaking. shr.el (shr-insert): Handle
     better.
    diff:
    === modified file 'lisp/gnus/ChangeLog'
    --- lisp/gnus/ChangeLog	2010-10-04 10:16:57 +0000
    +++ lisp/gnus/ChangeLog	2010-10-04 10:43:14 +0000
    @@ -1,6 +1,8 @@
     2010-10-04  Lars Magne Ingebrigtsen  
     
     	* shr.el (shr-ensure-paragraph): Fix the non-empty line case.
    +	(shr-insert): Tweak line breaking.
    +	(shr-insert): Handle 
     better.
     
     2010-10-04  Julien Danjou  
     
    
    === modified file 'lisp/gnus/shr.el'
    --- lisp/gnus/shr.el	2010-10-04 10:16:57 +0000
    +++ lisp/gnus/shr.el	2010-10-04 10:43:14 +0000
    @@ -214,14 +214,14 @@
           image)))
     
     (defun shr-tag-pre (cont)
    -  (let ((shr-folding-mode nil))
    +  (let ((shr-folding-mode 'none))
         (shr-ensure-newline)
         (shr-generic cont)
         (shr-ensure-newline)))
     
     (defun shr-tag-blockquote (cont)
       (let ((shr-indentation (+ shr-indentation 4)))
    -    (shr-tag-pre cont)))
    +    (shr-generic cont)))
     
     (defun shr-ensure-newline ()
       (unless (zerop (current-column))
    @@ -233,7 +233,7 @@
         (setq shr-state nil))
       (cond
        ((eq shr-folding-mode 'none)
    -    (insert t))
    +    (insert text))
        (t
         (let ((first t)
     	  column)
    @@ -244,7 +244,9 @@
     	(setq column (current-column))
     	(when (> column 0)
     	  (cond
    -	   ((> (+ column (length elem) 1) shr-width)
    +	   ((and (or (not first)
    +		     (eq shr-state 'space))
    +		 (> (+ column (length elem) 1) shr-width))
     	    (insert "\n"))
     	   ((not first)
     	    (insert " "))))
    @@ -258,9 +260,11 @@
     	(unless shr-start
     	  (setq shr-start (point)))
     	(insert elem))
    +      (setq shr-state nil)
           (when (and (string-match "[ \t\n]\\'" text)
     		 (not (bolp)))
    -	(insert " "))))))
    +	(insert " ")
    +	(setq shr-state 'space))))))
     
     (defun shr-get-image-data (url)
       "Get image data for URL.
    @@ -293,7 +297,8 @@
       (shr-generic cont))
     
     (defun shr-tag-br (cont)
    -  (shr-ensure-newline)
    +  (unless (bobp)
    +    (insert "\n"))
       (shr-generic cont))
     
     (defun shr-tag-h1 (cont)
    ------------------------------------------------------------
    revno: 101783
    author: Gnus developers
    committer: Katsumi Yamaoka 
    branch nick: trunk
    timestamp: Mon 2010-10-04 10:16:57 +0000
    message:
      Merge changes made in Gnus trunk.
      
      gnus-html.el (gnus-html-put-image): Fix resize image code.
      shr.el (shr-ensure-paragraph): Fix the non-empty line case.
    diff:
    === modified file 'lisp/gnus/ChangeLog'
    --- lisp/gnus/ChangeLog	2010-10-04 07:42:58 +0000
    +++ lisp/gnus/ChangeLog	2010-10-04 10:16:57 +0000
    @@ -1,5 +1,13 @@
     2010-10-04  Lars Magne Ingebrigtsen  
     
    +	* shr.el (shr-ensure-paragraph): Fix the non-empty line case.
    +
    +2010-10-04  Julien Danjou  
    +
    +	* gnus-html.el (gnus-html-put-image): Fix resize image code.
    +
    +2010-10-04  Lars Magne Ingebrigtsen  
    +
     	* shr.el (shr-insert): Use string anchors instead of line anchors.
     
     2010-10-03  Lars Magne Ingebrigtsen  
    
    === modified file 'lisp/gnus/gnus-html.el'
    --- lisp/gnus/gnus-html.el	2010-10-04 00:17:16 +0000
    +++ lisp/gnus/gnus-html.el	2010-10-04 10:16:57 +0000
    @@ -431,17 +431,19 @@
                                      (= (car size) 30)
                                      (= (cdr size) 30))))
                       ;; Good image, add it!
    -                  (let ((image (gnus-html-rescale-image
    +                  (let ((image (gnus-rescale-image
                                     image
    -                                ;; (width . height)
    -                                (cons
    -                                 ;; Aimed width
    -                                 (truncate
    -                                  (* gnus-max-image-proportion
    -                                     (- (nth 2 edges) (nth 0 edges))))
    -                                 ;; Aimed height
    -                                 (truncate (* gnus-max-image-proportion
    -                                              (- (nth 3 edges) (nth 1 edges))))))))
    +                                (let ((edges (gnus-window-inside-pixel-edges
    +                                              (get-buffer-window (current-buffer)))))
    +                                  ;; (width . height)
    +                                  (cons
    +                                   ;; Aimed width
    +                                   (truncate
    +                                    (* gnus-max-image-proportion
    +                                       (- (nth 2 edges) (nth 0 edges))))
    +                                   ;; Aimed height
    +                                   (truncate (* gnus-max-image-proportion
    +                                                (- (nth 3 edges) (nth 1 edges)))))))))
                         (delete-region start end)
                         (gnus-put-image image alt-text 'external)
                         (gnus-put-text-property start (point) 'help-echo alt-text)
    
    === modified file 'lisp/gnus/shr.el'
    --- lisp/gnus/shr.el	2010-10-04 07:42:58 +0000
    +++ lisp/gnus/shr.el	2010-10-04 10:16:57 +0000
    @@ -101,7 +101,7 @@
     	  (insert "\n"))
           (if (save-excursion
     	    (beginning-of-line)
    -	    (looking-at " *"))
    +	    (looking-at " *$"))
     	  (insert "\n")
     	(insert "\n\n")))))
    ------------------------------------------------------------
    revno: 101782
    author: Lars Magne Ingebrigtsen 
    committer: Katsumi Yamaoka 
    branch nick: trunk
    timestamp: Mon 2010-10-04 07:42:58 +0000
    message:
      shr.el (shr-insert): Use string anchors instead of line anchors.
    diff:
    === modified file 'lisp/gnus/ChangeLog'
    --- lisp/gnus/ChangeLog	2010-10-04 00:17:16 +0000
    +++ lisp/gnus/ChangeLog	2010-10-04 07:42:58 +0000
    @@ -1,3 +1,7 @@
    +2010-10-04  Lars Magne Ingebrigtsen  
    +
    +	* shr.el (shr-insert): Use string anchors instead of line anchors.
    +
     2010-10-03  Lars Magne Ingebrigtsen  
     
     	* shr.el: Add headings.
    
    === modified file 'lisp/gnus/shr.el'
    --- lisp/gnus/shr.el	2010-10-04 00:17:16 +0000
    +++ lisp/gnus/shr.el	2010-10-04 07:42:58 +0000
    @@ -237,7 +237,7 @@
        (t
         (let ((first t)
     	  column)
    -      (when (and (string-match "^[ \t\n]" text)
    +      (when (and (string-match "\\`[ \t\n]" text)
     		 (not (bolp)))
     	(insert " "))
           (dolist (elem (split-string text))
    @@ -258,7 +258,7 @@
     	(unless shr-start
     	  (setq shr-start (point)))
     	(insert elem))
    -      (when (and (string-match "[ \t\n]$" text)
    +      (when (and (string-match "[ \t\n]\\'" text)
     		 (not (bolp)))
     	(insert " "))))))
    ------------------------------------------------------------
    revno: 101781
    committer: Glenn Morris 
    branch nick: trunk
    timestamp: Sun 2010-10-03 18:19:56 -0700
    message:
      Minor appt.el changes.
      * lisp/calendar/appt.el (appt-add): Ensure reminders are enabled.
      (appt-activate): Give status messages.
    diff:
    === modified file 'lisp/ChangeLog'
    --- lisp/ChangeLog	2010-10-04 01:16:00 +0000
    +++ lisp/ChangeLog	2010-10-04 01:19:56 +0000
    @@ -1,3 +1,8 @@
    +2010-10-04  Glenn Morris  
    +
    +	* calendar/appt.el (appt-add): Ensure reminders are enabled.
    +	(appt-activate): Give status messages.
    +
     2010-10-03  Teodor Zlatanov  
     
     	* net/gnutls.el: Improve docs.  Remove starttls and ssl emulation.
    
    === modified file 'lisp/calendar/appt.el'
    --- lisp/calendar/appt.el	2010-10-03 01:56:11 +0000
    +++ lisp/calendar/appt.el	2010-10-04 01:19:56 +0000
    @@ -446,6 +446,7 @@
       (and warntime
            (not (integerp warntime))
            (error "Argument WARNTIME must be an integer, or nil"))
    +  (or appt-timer (appt-activate))
       (let ((time-msg (list (list (appt-convert-time time))
                             (concat time " " msg) t)))
         ;; It is presently non-sensical to have multiple warnings about
    @@ -618,13 +619,16 @@
         (when appt-timer
           (cancel-timer appt-timer)
           (setq appt-timer nil))
    -    (when appt-active
    -      (diary-check-diary-file)
    -      (add-hook 'write-file-functions 'appt-update-list)
    -      (setq appt-timer (run-at-time t 60 'appt-check)
    -            global-mode-string
    -            (append global-mode-string '(appt-mode-string)))
    -      (appt-check t))))
    +    (if appt-active
    +        (progn
    +          (diary-check-diary-file)
    +          (add-hook 'write-file-functions 'appt-update-list)
    +          (setq appt-timer (run-at-time t 60 'appt-check)
    +                global-mode-string
    +                (append global-mode-string '(appt-mode-string)))
    +          (appt-check t)
    +          (message "Appointment reminders enabled"))
    +      (message "Appointment reminders disabled"))))
     
     
     (provide 'appt)