Using saved parent location: http://bzr.savannah.gnu.org/r/emacs/trunk/ Now on revision 102731. ------------------------------------------------------------ revno: 102731 committer: Tassilo Horn branch nick: trunk timestamp: Thu 2010-12-30 21:23:13 +0100 message: * misc.texi (Document View): Update DocView section with newly supported document formats. diff: === modified file 'doc/emacs/ChangeLog' --- doc/emacs/ChangeLog 2010-12-21 07:54:27 +0000 +++ doc/emacs/ChangeLog 2010-12-30 20:23:13 +0000 @@ -1,3 +1,8 @@ +2010-12-30 Tassilo Horn + + * misc.texi (Document View): Update DocView section with newly + supported document formats. + 2010-12-21 Chong Yidong * killing.texi: Resection the Info version to conform to the === modified file 'doc/emacs/misc.texi' --- doc/emacs/misc.texi 2010-10-02 02:46:13 +0000 +++ doc/emacs/misc.texi 2010-12-30 20:23:13 +0000 @@ -27,28 +27,39 @@ @cindex PDF file @cindex PS file @cindex Postscript file +@cindex OpenDocument file +@cindex Microsoft Office file @cindex DocView mode @cindex mode, DocView @cindex document viewer (DocView) @findex doc-view-mode DocView mode (@code{doc-view-mode}) is a viewer for DVI, Postscript -(PS), and PDF documents. It provides features such as slicing, -zooming, and searching inside documents. It works by converting the -document to a set of images using the @command{gs} (GhostScript) -command, and displaying those images. +(PS), PDF, OpenDocument, and Microsoft Office documents. It provides +features such as slicing, zooming, and searching inside documents. It +works by converting the document to a set of images using the +@command{gs} (GhostScript) command and other external tools +@footnote{@code{gs} is a hard requirement. For DVI files, +@code{dvipdf} or @code{dvipdfm} is needed. For OpenDocument and +Microsoft Office documents, the @code{unoconv} tool is needed.}, and +displaying those images. @findex doc-view-toggle-display @findex doc-view-toggle-display @cindex doc-view-minor-mode - When you visit a PDF or DVI file, Emacs automatically switches to -DocView mode. When you visit a Postscript file, Emacs switches to PS -mode, a major mode for editing Postscript files as text; however, it -also enables DocView minor mode, so you can type @kbd{C-c C-c} to view -the document with DocView. (PDF and DVI files, unlike Postscript -files, are not usually human-editable.) In either case, repeating -@kbd{C-c C-c} (@code{doc-view-toggle-display}) toggles between DocView -and the file text. + When you visit a document file with the exception of Postscript +files, Emacs automatically switches to DocView mode if possible +@footnote{The needed external tools for this document type have to be +available, emacs needs to run in a graphical frame, and PNG image +support has to be compiled into emacs. If any of these requirements +is not fulfilled, DocView falls back to an appropriate mode.}. When +you visit a Postscript file, Emacs switches to PS mode, a major mode +for editing Postscript files as text; however, it also enables DocView +minor mode, so you can type @kbd{C-c C-c} to view the document with +DocView. (PDF and DVI files, unlike Postscript files, are not usually +human-editable.) In either case, repeating @kbd{C-c C-c} +(@code{doc-view-toggle-display}) toggles between DocView and the file +text. You can explicitly toggle DocView mode with the command @code{M-x doc-view-mode}, and DocView minor mode with the command @code{M-x ------------------------------------------------------------ revno: 102730 committer: Tassilo Horn branch nick: trunk timestamp: Thu 2010-12-30 19:08:18 +0100 message: * doc-view.el (doc-view-set-doc-type): New function refactored from doc-view-mode. (doc-view-fallback-mode): New function. (doc-view-mode): Use it. (doc-view-mode-maybe): New function that checks if doc-view-mode can be used and falls back to the next best mode otherwise. * files.el (auto-mode-alist): Use doc-view-mode-maybe for PDF, DVI, OpenDocument, and MS Office files. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2010-12-30 15:15:34 +0000 +++ lisp/ChangeLog 2010-12-30 18:08:18 +0000 @@ -1,3 +1,15 @@ +2010-12-30 Tassilo Horn + + * doc-view.el (doc-view-set-doc-type): New function refactored + from doc-view-mode. + (doc-view-fallback-mode): New function. + (doc-view-mode): Use it. + (doc-view-mode-maybe): New function that checks if doc-view-mode + can be used and falls back to the next best mode otherwise. + + * files.el (auto-mode-alist): Use doc-view-mode-maybe for PDF, + DVI, OpenDocument, and MS Office files. + 2010-12-30 Andreas Schwab * emacs-lisp/rx.el (rx-syntax): Fix typo. === modified file 'lisp/doc-view.el' --- lisp/doc-view.el 2010-12-30 14:58:32 +0000 +++ lisp/doc-view.el 2010-12-30 18:08:18 +0000 @@ -1059,11 +1059,7 @@ (set (make-local-variable 'image-mode-winprops-alist) t) ;; Switch to the previously used major mode or fall back to ;; normal mode. - (if doc-view-previous-major-mode - (funcall doc-view-previous-major-mode) - (let ((auto-mode-alist (rassq-delete-all 'doc-view-mode - (copy-alist auto-mode-alist)))) - (normal-mode))) + (doc-view-fallback-mode) (doc-view-minor-mode 1)) ;; Switch to doc-view-mode (when (and (buffer-modified-p) @@ -1250,6 +1246,41 @@ (dolist (x l1) (if (memq x l2) (push x l))) l)) +(defun doc-view-set-doc-type () + "Figure out the current document type (`doc-view-doc-type')." + (let ((name-types + (when buffer-file-name + (cdr (assoc (file-name-extension buffer-file-name) + '( + ;; DVI + ("dvi" dvi) + ;; PDF + ("pdf" pdf) ("epdf" pdf) + ;; PostScript + ("ps" ps) ("eps" ps) + ;; OpenDocument formats + ("odt" odf) ("ods" odf) ("odp" odf) ("odg" odf) + ("odc" odf) ("odi" odf) ("odm" odf) ("ott" odf) + ("ots" odf) ("otp" odf) ("otg" odf) + ;; Microsoft Office formats (also handled + ;; by the odf conversion chain) + ("doc" odf) ("docx" odf) ("xls" odf) ("xlsx" odf) + ("ppt" odf) ("pptx" odf)))))) + (content-types + (save-excursion + (goto-char (point-min)) + (cond + ((looking-at "%!") '(ps)) + ((looking-at "%PDF") '(pdf)) + ((looking-at "\367\002") '(dvi)))))) + (set (make-local-variable 'doc-view-doc-type) + (car (or (doc-view-intersection name-types content-types) + (when (and name-types content-types) + (error "Conflicting types: name says %s but content says %s" + name-types content-types)) + name-types content-types + (error "Cannot determine the document type")))))) + ;;;###autoload (defun doc-view-mode () "Major mode in DocView buffers. @@ -1266,49 +1297,19 @@ ;; The doc is empty or doesn't exist at all, so fallback to ;; another mode. We used to also check file-exists-p, but this ;; returns nil for tar members. - (let ((auto-mode-alist (remq (rassq 'doc-view-mode auto-mode-alist) - auto-mode-alist))) - (normal-mode)) + (doc-view-fallback-mode) (let* ((prev-major-mode (if (eq major-mode 'doc-view-mode) doc-view-previous-major-mode - (when (not (eq major-mode 'fundamental-mode)) + (when (not (memq major-mode + '(doc-view-mode fundamental-mode))) major-mode)))) (kill-all-local-variables) (set (make-local-variable 'doc-view-previous-major-mode) prev-major-mode)) ;; Figure out the document type. - (let ((name-types - (when buffer-file-name - (cdr (assoc (file-name-extension buffer-file-name) - '( - ;; DVI - ("dvi" dvi) - ;; PDF - ("pdf" pdf) ("epdf" pdf) - ;; PostScript - ("ps" ps) ("eps" ps) - ;; OpenDocument formats - ("odt" odf) ("ods" odf) ("odp" odf) ("odg" odf) - ("odc" odf) ("odi" odf) ("odm" odf) ("ott" odf) - ("ots" odf) ("otp" odf) ("otg" odf) - ;; Microsoft Office formats (also handled - ;; by the odf conversion chain) - ("doc" odf) ("docx" odf) ("xls" odf) ("xlsx" odf)))))) - (content-types - (save-excursion - (goto-char (point-min)) - (cond - ((looking-at "%!") '(ps)) - ((looking-at "%PDF") '(pdf)) - ((looking-at "\367\002") '(dvi)))))) - (set (make-local-variable 'doc-view-doc-type) - (car (or (doc-view-intersection name-types content-types) - (when (and name-types content-types) - (error "Conflicting types: name says %s but content says %s" - name-types content-types)) - name-types content-types - (error "Cannot determine the document type"))))) + (unless doc-view-doc-type + (doc-view-set-doc-type)) (doc-view-make-safe-dir doc-view-cache-directory) ;; Handle compressed files, remote files, files inside archives @@ -1376,6 +1377,28 @@ (set (make-local-variable 'view-read-only) nil) (run-mode-hooks 'doc-view-mode-hook))) +(defun doc-view-fallback-mode () + "Fallback to the previous or next best major mode." + (if doc-view-previous-major-mode + (funcall doc-view-previous-major-mode) + (let ((auto-mode-alist (rassq-delete-all + 'doc-view-mode-maybe + (rassq-delete-all 'doc-view-mode + (copy-alist auto-mode-alist))))) + (normal-mode)))) + +;;;###autoload +(defun doc-view-mode-maybe () + "Switch to `doc-view-mode' if possible. +If the required external tools are not available, then fallback +to the next best mode." + (condition-case nil + (doc-view-set-doc-type) + (error (doc-view-fallback-mode))) + (if (doc-view-mode-p doc-view-doc-type) + (doc-view-mode) + (doc-view-fallback-mode))) + ;;;###autoload (define-minor-mode doc-view-minor-mode "Toggle Doc view minor mode. === modified file 'lisp/files.el' --- lisp/files.el 2010-12-13 15:27:36 +0000 +++ lisp/files.el 2010-12-30 18:08:18 +0000 @@ -2372,7 +2372,7 @@ ("\\.\\(diffs?\\|patch\\|rej\\)\\'" . diff-mode) ("\\.\\(dif\\|pat\\)\\'" . diff-mode) ; for MSDOG ("\\.[eE]?[pP][sS]\\'" . ps-mode) - ("\\.\\(?:PDF\\|DVI\\|pdf\\|dvi\\)\\'" . doc-view-mode) + ("\\.\\(?:PDF\\|DVI\\|OD[FGPST]\\|DOCX?\\|XLSX?\\|PPTX?\\|pdf\\|dvi\\|od[fgpst]\\|docx?\\|xlsx?\\|pptx?\\)\\'" . doc-view-mode-maybe) ("configure\\.\\(ac\\|in\\)\\'" . autoconf-mode) ("\\.s\\(v\\|iv\\|ieve\\)\\'" . sieve-mode) ("BROWSE\\'" . ebrowse-tree-mode) ------------------------------------------------------------ revno: 102729 committer: Andreas Schwab branch nick: emacs timestamp: Thu 2010-12-30 16:15:34 +0100 message: * lisp/emacs-lisp/rx.el (rx-syntax): Fix typo. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2010-12-30 14:58:32 +0000 +++ lisp/ChangeLog 2010-12-30 15:15:34 +0000 @@ -1,3 +1,7 @@ +2010-12-30 Andreas Schwab + + * emacs-lisp/rx.el (rx-syntax): Fix typo. + 2010-12-30 Tassilo Horn * doc-view.el (doc-view-toggle-display): Perform rassq-delete-all === modified file 'lisp/emacs-lisp/rx.el' --- lisp/emacs-lisp/rx.el 2010-12-26 23:17:09 +0000 +++ lisp/emacs-lisp/rx.el 2010-12-30 15:15:34 +0000 @@ -767,7 +767,7 @@ (unless syntax ;; Try sregex compatibility. (cond - ((character sym) (setq syntax sym)) + ((characterp sym) (setq syntax sym)) ((symbolp sym) (let ((name (symbol-name sym))) (if (= 1 (length name)) ------------------------------------------------------------ revno: 102728 committer: Tassilo Horn branch nick: trunk timestamp: Thu 2010-12-30 15:58:32 +0100 message: * doc-view.el (doc-view-toggle-display): Perform rassq-delete-all on a copy of auto-mode-alist, because that deletes with side effects. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2010-12-30 14:47:53 +0000 +++ lisp/ChangeLog 2010-12-30 14:58:32 +0000 @@ -1,5 +1,11 @@ 2010-12-30 Tassilo Horn + * doc-view.el (doc-view-toggle-display): Perform rassq-delete-all + on a copy of auto-mode-alist, because that deletes with side + effects. + +2010-12-30 Tassilo Horn + * doc-view.el (doc-view-mode, doc-view-toggle-display): Use normal-mode without doc-view-mode bindings in auto-mode-alist as fallback instead of hard coding fundamental mode. === modified file 'lisp/doc-view.el' --- lisp/doc-view.el 2010-12-30 14:47:53 +0000 +++ lisp/doc-view.el 2010-12-30 14:58:32 +0000 @@ -1061,7 +1061,8 @@ ;; normal mode. (if doc-view-previous-major-mode (funcall doc-view-previous-major-mode) - (let ((auto-mode-alist (rassq-delete-all 'doc-view-mode auto-mode-alist))) + (let ((auto-mode-alist (rassq-delete-all 'doc-view-mode + (copy-alist auto-mode-alist)))) (normal-mode))) (doc-view-minor-mode 1)) ;; Switch to doc-view-mode ------------------------------------------------------------ revno: 102727 committer: Tassilo Horn branch nick: trunk timestamp: Thu 2010-12-30 15:47:53 +0100 message: * doc-view.el (doc-view-mode, doc-view-toggle-display): Use normal-mode without doc-view-mode bindings in auto-mode-alist as fallback instead of hard coding fundamental mode. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2010-12-30 13:53:22 +0000 +++ lisp/ChangeLog 2010-12-30 14:47:53 +0000 @@ -1,5 +1,11 @@ 2010-12-30 Tassilo Horn + * doc-view.el (doc-view-mode, doc-view-toggle-display): Use + normal-mode without doc-view-mode bindings in auto-mode-alist as + fallback instead of hard coding fundamental mode. + +2010-12-30 Tassilo Horn + * doc-view.el (doc-view-doc->txt): Handle OpenDocument (or MS Office) files also for searching. === modified file 'lisp/doc-view.el' --- lisp/doc-view.el 2010-12-30 13:53:22 +0000 +++ lisp/doc-view.el 2010-12-30 14:47:53 +0000 @@ -1047,7 +1047,6 @@ ;;;;; Toggle between editing and viewing - (defun doc-view-toggle-display () "Toggle between editing a document as text or viewing it." (interactive) @@ -1058,11 +1057,12 @@ (setq buffer-read-only nil) (remove-overlays (point-min) (point-max) 'doc-view t) (set (make-local-variable 'image-mode-winprops-alist) t) - ;; Switch to the previously used major mode or fall back to fundamental - ;; mode. + ;; Switch to the previously used major mode or fall back to + ;; normal mode. (if doc-view-previous-major-mode (funcall doc-view-previous-major-mode) - (fundamental-mode)) + (let ((auto-mode-alist (rassq-delete-all 'doc-view-mode auto-mode-alist))) + (normal-mode))) (doc-view-minor-mode 1)) ;; Switch to doc-view-mode (when (and (buffer-modified-p) @@ -1271,7 +1271,8 @@ (let* ((prev-major-mode (if (eq major-mode 'doc-view-mode) doc-view-previous-major-mode - major-mode))) + (when (not (eq major-mode 'fundamental-mode)) + major-mode)))) (kill-all-local-variables) (set (make-local-variable 'doc-view-previous-major-mode) prev-major-mode)) ------------------------------------------------------------ revno: 102726 committer: Tassilo Horn branch nick: trunk timestamp: Thu 2010-12-30 14:53:22 +0100 message: * doc-view.el (doc-view-doc->txt): Handle OpenDocument (or MS Office) files also for searching. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2010-12-30 13:45:09 +0000 +++ lisp/ChangeLog 2010-12-30 13:53:22 +0000 @@ -1,5 +1,10 @@ 2010-12-30 Tassilo Horn + * doc-view.el (doc-view-doc->txt): Handle OpenDocument (or MS + Office) files also for searching. + +2010-12-30 Tassilo Horn + * doc-view.el: Implement viewing of OpenDocument (and Microsoft Office) files. Not yet enabled via auto-mode-list. (doc-view-unoconv-program): New custom variable. === modified file 'lisp/doc-view.el' --- lisp/doc-view.el 2010-12-30 13:45:09 +0000 +++ lisp/doc-view.el 2010-12-30 13:53:22 +0000 @@ -813,6 +813,12 @@ (doc-view-pdf->txt (expand-file-name "doc.pdf" (doc-view-current-cache-dir)) txt callback)) + (odf + ;; Doc is some ODF (or MS Office) doc. This means that a doc.pdf + ;; already exists in its cache subdirectory. + (doc-view-pdf->txt (expand-file-name "doc.pdf" + (doc-view-current-cache-dir)) + txt callback)) (t (error "DocView doesn't know what to do")))) (defun doc-view-ps->pdf (ps pdf callback) ------------------------------------------------------------ revno: 102725 committer: Tassilo Horn branch nick: trunk timestamp: Thu 2010-12-30 14:45:09 +0100 message: * doc-view.el: Implement viewing of OpenDocument (and Microsoft Office) files. Not yet enabled via auto-mode-list. (doc-view-unoconv-program): New custom variable. (doc-view-mode-p): Handle new odf document type. (doc-view-odf->pdf): New conversion function. (doc-view-convert-current-doc): Call it for odf files. (doc-view-mode): Recognize newly supported file extensions. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2010-12-30 09:04:15 +0000 +++ lisp/ChangeLog 2010-12-30 13:45:09 +0000 @@ -1,3 +1,13 @@ +2010-12-30 Tassilo Horn + + * doc-view.el: Implement viewing of OpenDocument (and Microsoft + Office) files. Not yet enabled via auto-mode-list. + (doc-view-unoconv-program): New custom variable. + (doc-view-mode-p): Handle new odf document type. + (doc-view-odf->pdf): New conversion function. + (doc-view-convert-current-doc): Call it for odf files. + (doc-view-mode): Recognize newly supported file extensions. + 2010-12-30 Michael Albinus * net/tramp.el (tramp-default-method-alist) === modified file 'lisp/doc-view.el' --- lisp/doc-view.el 2010-07-14 15:57:54 +0000 +++ lisp/doc-view.el 2010-12-30 13:45:09 +0000 @@ -190,6 +190,13 @@ :type 'file :group 'doc-view) +(defcustom doc-view-unoconv-program (executable-find "unoconv") + "Program to convert any file type readable by OpenOffice.org to PDF. + +Needed for viewing OpenOffice.org (and MS Office) files." + :type 'file + :group 'doc-view) + (defcustom doc-view-ps2pdf-program (executable-find "ps2pdf") "Program to convert PS files to PDF. @@ -604,8 +611,9 @@ ;;;###autoload (defun doc-view-mode-p (type) - "Return non-nil if image type TYPE is available for `doc-view'. -Image types are symbols like `dvi', `postscript' or `pdf'." + "Return non-nil if document type TYPE is available for `doc-view'. +Document types are symbols like `dvi', `ps', `pdf', or `odf' (any +OpenDocument format)." (and (display-graphic-p) (image-type-available-p 'png) (cond @@ -619,6 +627,10 @@ (eq type 'pdf)) (and doc-view-ghostscript-program (executable-find doc-view-ghostscript-program))) + ((eq type 'odf) + (and doc-view-unoconv-program + (executable-find doc-view-unoconv-program) + (doc-view-mode-p 'pdf))) (t ;; unknown image type nil)))) @@ -692,6 +704,13 @@ (list "-o" pdf dvi) callback))) +(defun doc-view-odf->pdf (odf callback) + "Convert ODF to PDF asynchronously and call CALLBACK when finished. +The converted PDF is put into the current cache directory, and it +is named like ODF with the extension turned to pdf." + (doc-view-start-process "odf->pdf" doc-view-unoconv-program + (list "-f" "pdf" "-o" (doc-view-current-cache-dir) odf) + callback)) (defun doc-view-pdf/ps->png (pdf-ps png) "Convert PDF-PS to PNG asynchronously." @@ -838,6 +857,24 @@ (png-file png-file)) (doc-view-dvi->pdf doc-view-buffer-file-name pdf (lambda () (doc-view-pdf/ps->png pdf png-file))))) + (odf + ;; ODF files have to be converted to PDF before Ghostscript can + ;; process it. + (lexical-let + ((pdf (expand-file-name "doc.pdf" doc-view-current-cache-dir)) + (opdf (expand-file-name (concat (file-name-sans-extension + (file-name-nondirectory doc-view-buffer-file-name)) + ".pdf") + doc-view-current-cache-dir)) + (png-file png-file)) + ;; The unoconv tool only supports a output directory, but no + ;; file name. It's named like the input file with the + ;; extension replaced by pdf. + (doc-view-odf->pdf doc-view-buffer-file-name + (lambda () + ;; Rename to doc.pdf + (rename-file opdf pdf) + (doc-view-pdf/ps->png pdf png-file))))) (pdf (let ((pages (doc-view-active-pages))) ;; Convert PDF to PNG images starting with the active pages. @@ -1236,11 +1273,20 @@ (let ((name-types (when buffer-file-name (cdr (assoc (file-name-extension buffer-file-name) - '(("dvi" dvi) - ("pdf" pdf) - ("epdf" pdf) - ("ps" ps) - ("eps" ps)))))) + '( + ;; DVI + ("dvi" dvi) + ;; PDF + ("pdf" pdf) ("epdf" pdf) + ;; PostScript + ("ps" ps) ("eps" ps) + ;; OpenDocument formats + ("odt" odf) ("ods" odf) ("odp" odf) ("odg" odf) + ("odc" odf) ("odi" odf) ("odm" odf) ("ott" odf) + ("ots" odf) ("otp" odf) ("otg" odf) + ;; Microsoft Office formats (also handled + ;; by the odf conversion chain) + ("doc" odf) ("docx" odf) ("xls" odf) ("xlsx" odf)))))) (content-types (save-excursion (goto-char (point-min)) ------------------------------------------------------------ revno: 102724 committer: Jan D. branch nick: trunk timestamp: Thu 2010-12-30 12:30:55 +0100 message: Encode frame title and icon name before setting. * coding.h (ENCODE_UTF_8): Remove "Used by ..." comment. * nsfns.m (ns_set_name_iconic): Remove. (ns_set_name_internal): New function. (Vicon_title_format): Extern declare. (ns_set_name): Call ns_set_name_internal. (x_explicitly_set_name): Remove call to ns_set_name_iconic. (x_implicitly_set_name): Ditto. (x_set_title): Remove commet about EXPLICIT. Call ns_set_name_internal. (ns_set_name_as_filename): Encode name with ENCODE_UTF_8 (Bug#7517). diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2010-12-29 11:16:44 +0000 +++ src/ChangeLog 2010-12-30 11:30:55 +0000 @@ -1,3 +1,16 @@ +2010-12-30 Jan Djärv + + * coding.h (ENCODE_UTF_8): Remove "Used by ..." comment. + + * nsfns.m (ns_set_name_iconic): Remove. + (ns_set_name_internal): New function (Bug#7517). + (Vicon_title_format): Extern declare. + (ns_set_name): Call ns_set_name_internal. + (x_explicitly_set_name): Remove call to ns_set_name_iconic. + (x_implicitly_set_name): Ditto. + (x_set_title): Remove commet about EXPLICIT. Call ns_set_name_internal. + (ns_set_name_as_filename): Encode name with ENCODE_UTF_8 (Bug#7517). + 2010-12-29 Štěpán Němec (tiny change) * window.c (syms_of_window): Add missing defsubr for === modified file 'src/coding.h' --- src/coding.h 2010-10-08 10:14:47 +0000 +++ src/coding.h 2010-12-30 11:30:55 +0000 @@ -686,8 +686,7 @@ ? code_convert_string_norecord (str, Vlocale_coding_system, 0) \ : str) -/* Used by the gtk menu code. Note that this encodes utf-8, not - utf-8-emacs, so it's not a no-op. */ +/* Note that this encodes utf-8, not utf-8-emacs, so it's not a no-op. */ #define ENCODE_UTF_8(str) code_convert_string_norecord (str, Qutf_8, 1) /* Extern declarations. */ === modified file 'src/nsfns.m' --- src/nsfns.m 2010-11-14 19:58:24 +0000 +++ src/nsfns.m 2010-12-30 11:30:55 +0000 @@ -82,7 +82,7 @@ extern Lisp_Object Qheight, Qminibuffer, Qname, Qonly, Qwidth; extern Lisp_Object Qunsplittable, Qmenu_bar_lines, Qbuffer_predicate, Qtitle; extern Lisp_Object Qnone; -extern Lisp_Object Vframe_title_format; +extern Lisp_Object Vframe_title_format, Vicon_title_format; /* The below are defined in frame.c. */ @@ -473,55 +473,37 @@ [NSString stringWithUTF8String: SDATA (arg)]]; } - static void -ns_set_name_iconic (struct frame *f, Lisp_Object name, int explicit) +ns_set_name_internal (FRAME_PTR f, Lisp_Object name) { + struct gcpro gcpro1; + Lisp_Object encoded_name, encoded_icon_name; + NSString *str; NSView *view = FRAME_NS_VIEW (f); - NSTRACE (ns_set_name_iconic); - - if (ns_in_resize) - return; - - /* Make sure that requests from lisp code override requests from - Emacs redisplay code. */ - if (explicit) - { - /* If we're switching from explicit to implicit, we had better - update the mode lines and thereby update the title. */ - if (f->explicit_name && NILP (name)) - update_mode_lines = 1; - - f->explicit_name = ! NILP (name); - } - else if (f->explicit_name) - name = f->name; - - /* title overrides explicit name */ - if (! NILP (f->title)) - name = f->title; - - /* icon_name overrides title and explicit name */ - if (! NILP (f->icon_name)) - name = f->icon_name; - - if (NILP (name)) - name = build_string([ns_app_name UTF8String]); + + GCPRO1 (name); + encoded_name = ENCODE_UTF_8 (name); + UNGCPRO; + + str = [NSString stringWithUTF8String: SDATA (encoded_name)]; + + /* Don't change the name if it's already NAME. */ + if (! [[[view window] title] isEqualToString: str]) + [[view window] setTitle: str]; + + if (!STRINGP (f->icon_name)) + encoded_icon_name = encoded_name; else - CHECK_STRING (name); - - /* Don't change the name if it's already NAME. */ + encoded_icon_name = ENCODE_UTF_8 (f->icon_name); + + str = [NSString stringWithUTF8String: SDATA (encoded_icon_name)]; + if ([[view window] miniwindowTitle] && - ([[[view window] miniwindowTitle] - isEqualToString: [NSString stringWithUTF8String: - SDATA (name)]])) - return; + ! [[[view window] miniwindowTitle] isEqualToString: str]) + [[view window] setMiniwindowTitle: str]; - [[view window] setMiniwindowTitle: - [NSString stringWithUTF8String: SDATA (name)]]; } - static void ns_set_name (struct frame *f, Lisp_Object name, int explicit) { @@ -547,6 +529,12 @@ if (NILP (name)) name = build_string([ns_app_name UTF8String]); + else + CHECK_STRING (name); + + /* Don't change the name if it's already NAME. */ + if (! NILP (Fstring_equal (name, f->name))) + return; f->name = name; @@ -554,17 +542,7 @@ if (! NILP (f->title)) name = f->title; - CHECK_STRING (name); - - view = FRAME_NS_VIEW (f); - - /* Don't change the name if it's already NAME. */ - if ([[[view window] title] - isEqualToString: [NSString stringWithUTF8String: - SDATA (name)]]) - return; - [[view window] setTitle: [NSString stringWithUTF8String: - SDATA (name)]]; + ns_set_name_internal (f, name); } @@ -575,7 +553,6 @@ x_explicitly_set_name (FRAME_PTR f, Lisp_Object arg, Lisp_Object oldval) { NSTRACE (x_explicitly_set_name); - ns_set_name_iconic (f, arg, 1); ns_set_name (f, arg, 1); } @@ -587,9 +564,10 @@ x_implicitly_set_name (FRAME_PTR f, Lisp_Object arg, Lisp_Object oldval) { NSTRACE (x_implicitly_set_name); - if (FRAME_ICONIFIED_P (f)) - ns_set_name_iconic (f, arg, 0); - else if (FRAME_NS_P (f) && EQ (Vframe_title_format, Qt)) + + /* Deal with NS specific format t. */ + if (FRAME_NS_P (f) && ((FRAME_ICONIFIED_P (f) && EQ (Vicon_title_format, Qt)) + || EQ (Vframe_title_format, Qt))) ns_set_name_as_filename (f); else ns_set_name (f, arg, 0); @@ -597,15 +575,8 @@ /* Change the title of frame F to NAME. - If NAME is nil, use the frame name as the title. - - If EXPLICIT is non-zero, that indicates that lisp code is setting the - name; if NAME is a string, set F's name to NAME and set - F->explicit_name; if NAME is Qnil, then clear F->explicit_name. - - If EXPLICIT is zero, that indicates that Emacs redisplay code is - suggesting a new name, which lisp code should override; if - F->explicit_name is set, ignore the new name; otherwise, set it. */ + If NAME is nil, use the frame name as the title. */ + static void x_set_title (struct frame *f, Lisp_Object name, Lisp_Object old_name) { @@ -617,6 +588,13 @@ update_mode_lines = 1; f->title = name; + + if (NILP (name)) + name = f->name; + else + CHECK_STRING (name); + + ns_set_name_internal (f, name); } @@ -628,6 +606,8 @@ Lisp_Object buf = XWINDOW (f->selected_window)->buffer; const char *title; NSAutoreleasePool *pool; + struct gcpro gcpro1; + Lisp_Object encoded_name; NSTRACE (ns_set_name_as_filename); if (f->explicit_name || ! NILP (f->title) || ns_in_resize) @@ -636,7 +616,7 @@ BLOCK_INPUT; pool = [[NSAutoreleasePool alloc] init]; name = XBUFFER (buf)->filename; - if (NILP (name) || FRAME_ICONIFIED_P (f)) name =XBUFFER (buf)->name; + if (NILP (name) || FRAME_ICONIFIED_P (f)) name = XBUFFER (buf)->name; if (FRAME_ICONIFIED_P (f) && !NILP (f->icon_name)) name = f->icon_name; @@ -646,12 +626,16 @@ else CHECK_STRING (name); + GCPRO1 (name); + encoded_name = ENCODE_UTF_8 (name); + UNGCPRO; + view = FRAME_NS_VIEW (f); title = FRAME_ICONIFIED_P (f) ? [[[view window] miniwindowTitle] UTF8String] : [[[view window] title] UTF8String]; - if (title && (! strcmp (title, SDATA (name)))) + if (title && (! strcmp (title, SDATA (encoded_name)))) { [pool release]; UNBLOCK_INPUT; @@ -664,7 +648,7 @@ /* work around a bug observed on 10.3 where setTitleWithRepresentedFilename does not clear out previous state if given filename does not exist */ - NSString *str = [NSString stringWithUTF8String: SDATA (name)]; + NSString *str = [NSString stringWithUTF8String: SDATA (encoded_name)]; if (![[NSFileManager defaultManager] fileExistsAtPath: str]) { [[view window] setTitleWithRepresentedFilename: @""]; @@ -676,14 +660,14 @@ } #else [[view window] setTitleWithRepresentedFilename: - [NSString stringWithUTF8String: SDATA (name)]]; + [NSString stringWithUTF8String: SDATA (encoded_name)]]; #endif f->name = name; } else { [[view window] setMiniwindowTitle: - [NSString stringWithUTF8String: SDATA (name)]]; + [NSString stringWithUTF8String: SDATA (encoded_name)]]; } [pool release]; UNBLOCK_INPUT; ------------------------------------------------------------ revno: 102723 committer: Michael Albinus branch nick: trunk timestamp: Thu 2010-12-30 10:04:15 +0100 message: * net/tramp.el (tramp-default-method-alist) (tramp-default-user-alist) (tramp-local-host-regexp, tramp-prefix-domain-format) (tramp-prefix-domain-regexp): Set tramp-autoload cookie. * net/tramp-ftp.el: * net/tramp-gvfs.el: * net/tramp-gw.el: * net/tramp-imap.el: * net/tramp-sh.el: * net/tramp-smb.el: Add tramp-autoload cookie for initialisation code of `tramp-default-method-alist' and `tramp-default-user-alist'. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2010-12-29 03:24:09 +0000 +++ lisp/ChangeLog 2010-12-30 09:04:15 +0000 @@ -1,3 +1,18 @@ +2010-12-30 Michael Albinus + + * net/tramp.el (tramp-default-method-alist) + (tramp-default-user-alist) + (tramp-local-host-regexp, tramp-prefix-domain-format) + (tramp-prefix-domain-regexp): Set tramp-autoload cookie. + + * net/tramp-ftp.el: + * net/tramp-gvfs.el: + * net/tramp-gw.el: + * net/tramp-imap.el: + * net/tramp-sh.el: + * net/tramp-smb.el: Add tramp-autoload cookie for initialisation + code of `tramp-default-method-alist' and `tramp-default-user-alist'. + 2010-12-29 Karl Fogel * saveplace.el (save-place-alist-to-file): Save list sorted and === modified file 'lisp/net/tramp-ftp.el' --- lisp/net/tramp-ftp.el 2010-12-02 19:34:31 +0000 +++ lisp/net/tramp-ftp.el 2010-12-30 09:04:15 +0000 @@ -105,13 +105,13 @@ ;; ... and add it to the method list. ;;;###tramp-autoload (unless (featurep 'xemacs) - (add-to-list 'tramp-methods (cons tramp-ftp-method nil))) + (add-to-list 'tramp-methods (cons tramp-ftp-method nil)) -;; Add some defaults for `tramp-default-method-alist'. -(add-to-list 'tramp-default-method-alist - (list "\\`ftp\\." nil tramp-ftp-method)) -(add-to-list 'tramp-default-method-alist - (list nil "\\`\\(anonymous\\|ftp\\)\\'" tramp-ftp-method)) + ;; Add some defaults for `tramp-default-method-alist'. + (add-to-list 'tramp-default-method-alist + (list "\\`ftp\\." nil tramp-ftp-method)) + (add-to-list 'tramp-default-method-alist + (list nil "\\`\\(anonymous\\|ftp\\)\\'" tramp-ftp-method))) ;; Add completion function for FTP method. (tramp-set-completion-function === modified file 'lisp/net/tramp-gvfs.el' --- lisp/net/tramp-gvfs.el 2010-12-02 19:34:31 +0000 +++ lisp/net/tramp-gvfs.el 2010-12-30 09:04:15 +0000 @@ -124,6 +124,7 @@ ;; Add a default for `tramp-default-user-alist'. Rule: For the SYNCE ;; method, no user is chosen. +;;;###tramp-autoload (add-to-list 'tramp-default-user-alist '("\\`synce\\'" nil nil)) (defcustom tramp-gvfs-zeroconf-domain "local" === modified file 'lisp/net/tramp-gw.el' --- lisp/net/tramp-gw.el 2010-12-02 19:34:31 +0000 +++ lisp/net/tramp-gw.el 2010-12-30 09:04:15 +0000 @@ -72,6 +72,7 @@ (list "Default server" "socks" tramp-gw-default-socks-port 5)) ;; Add a default for `tramp-default-user-alist'. Default is the local user. +;;;###tramp-autoload (add-to-list 'tramp-default-user-alist (list (concat "\\`" === modified file 'lisp/net/tramp-imap.el' --- lisp/net/tramp-imap.el 2010-12-02 19:34:31 +0000 +++ lisp/net/tramp-imap.el 2010-12-30 09:04:15 +0000 @@ -96,6 +96,7 @@ (list tramp-imaps-method '(tramp-default-port 993)))) ;; Add a default for `tramp-default-user-alist'. Default is the local user. +;;;###tramp-autoload (add-to-list 'tramp-default-user-alist (list (concat "\\`" === modified file 'lisp/net/tramp-sh.el' --- lisp/net/tramp-sh.el 2010-12-27 10:56:26 +0000 +++ lisp/net/tramp-sh.el 2010-12-30 09:04:15 +0000 @@ -380,13 +380,16 @@ (tramp-copy-args (("%k" "-p"))) (tramp-copy-keep-date t))) +;;;###tramp-autoload (add-to-list 'tramp-default-method-alist `(,tramp-local-host-regexp "\\`root\\'" "su")) +;;;###tramp-autoload (add-to-list 'tramp-default-user-alist `(,(concat "\\`" (regexp-opt '("su" "sudo" "ksu")) "\\'") nil "root")) ;; Do not add "ssh" based methods, otherwise ~/.ssh/config would be ignored. +;;;###tramp-autoload (add-to-list 'tramp-default-user-alist `(,(concat "\\`" === modified file 'lisp/net/tramp-smb.el' --- lisp/net/tramp-smb.el 2010-12-02 19:34:31 +0000 +++ lisp/net/tramp-smb.el 2010-12-30 09:04:15 +0000 @@ -43,11 +43,13 @@ ;; Add a default for `tramp-default-method-alist'. Rule: If there is ;; a domain in USER, it must be the SMB method. +;;;###tramp-autoload (add-to-list 'tramp-default-method-alist `(nil ,tramp-prefix-domain-regexp ,tramp-smb-method)) ;; Add a default for `tramp-default-user-alist'. Rule: For the SMB method, ;; the anonymous user is chosen. +;;;###tramp-autoload (add-to-list 'tramp-default-user-alist `(,(concat "\\`" tramp-smb-method "\\'") nil nil)) === modified file 'lisp/net/tramp.el' --- lisp/net/tramp.el 2010-12-14 20:33:33 +0000 +++ lisp/net/tramp.el 2010-12-30 09:04:15 +0000 @@ -318,6 +318,7 @@ :group 'tramp :type 'string) +;;;###tramp-autoload (defcustom tramp-default-method-alist nil "*Default method to use for specific host/user pairs. This is an alist of items (HOST USER METHOD). The first matching item @@ -344,6 +345,7 @@ :group 'tramp :type '(choice (const nil) string)) +;;;###tramp-autoload (defcustom tramp-default-user-alist nil "*Default user to use for specific method/host pairs. This is an alist of items (METHOD HOST USER). The first matching item @@ -384,6 +386,7 @@ (choice :tag "User regexp" regexp sexp) (choice :tag " Proxy name" string (const nil))))) +;;;###tramp-autoload (defconst tramp-local-host-regexp (concat "\\`" @@ -666,9 +669,11 @@ (defconst tramp-user-regexp "[^:/ \t]+" "*Regexp matching user names.") +;;;###tramp-autoload (defconst tramp-prefix-domain-format "%" "*String matching delimeter between user and domain names.") +;;;###tramp-autoload (defconst tramp-prefix-domain-regexp (regexp-quote tramp-prefix-domain-format) "*Regexp matching delimeter between user and domain names. ------------------------------------------------------------ revno: 102722 author: Štěpán Němec committer: Chong Yidong branch nick: trunk timestamp: Wed 2010-12-29 19:16:44 +0800 message: * window.c (syms_of_window): Add missing defsubr for window-use-time. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2010-12-28 16:34:04 +0000 +++ src/ChangeLog 2010-12-29 11:16:44 +0000 @@ -1,3 +1,8 @@ +2010-12-29 Štěpán Němec (tiny change) + + * window.c (syms_of_window): Add missing defsubr for + window-use-time. + 2010-12-28 Andreas Schwab * xterm.h (x_alloc_lighter_color_for_widget): Restore declaration. === modified file 'src/window.c' --- src/window.c 2010-12-27 17:29:38 +0000 +++ src/window.c 2010-12-29 11:16:44 +0000 @@ -7204,6 +7204,7 @@ defsubr (&Sprevious_window); defsubr (&Sother_window); defsubr (&Sget_lru_window); + defsubr (&Swindow_use_time); defsubr (&Sget_largest_window); defsubr (&Sget_buffer_window); defsubr (&Sdelete_other_windows);