From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/68493 Path: news.gmane.org!not-for-mail From: Michael Albinus Newsgroups: gmane.emacs.tramp,gmane.emacs.gnus.general Subject: Re: file storage in IMAP (eventually for Tramp) working and needs testing Date: Sat, 25 Apr 2009 19:25:58 +0200 Message-ID: <877i184pcp.fsf@gmx.de> References: <86k5n1443g.fsf@lifelogs.com> <86k55otuwi.fsf@lifelogs.com> <86vdp7qk67.fsf@lifelogs.com> <87bpqx1vfv.fsf@gmx.de> <86k55cb4ye.fsf@jumptrading.com> <86skjz5a8v.fsf@lifelogs.com> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: ger.gmane.org 1240680398 17327 80.91.229.2 (25 Apr 2009 17:26:38 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 25 Apr 2009 17:26:38 +0000 (UTC) Cc: tramp-devel@mail.freesoftware.fsf.org, ding@gnus.org To: Ted Zlatanov Original-X-From: tramp-devel-bounces+tramp=quimby.gnus.org@gnu.org Sat Apr 25 17:26:34 2009 Return-path: Envelope-to: tramp@deer.gmane.org Original-Received: from quimby.gnus.org ([80.91.231.51]) by ciao.gmane.org with esmtp (Exim 4.43) id 1Lxle0-0002HX-Dx for tramp@deer.gmane.org; Sat, 25 Apr 2009 17:26:28 +0000 Original-Received: from lists.gnu.org ([199.232.76.165]) by quimby.gnus.org with esmtp (Exim 3.36 #1 (Debian)) id 1LxleQ-00019A-00 for ; Sat, 25 Apr 2009 19:26:54 +0200 Original-Received: from localhost ([127.0.0.1]:35908 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Lxldx-0002DF-NQ for tramp@quimby.gnus.org; Sat, 25 Apr 2009 13:26:25 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Lxldp-0002Cy-36 for tramp-devel@mail.freesoftware.fsf.org; Sat, 25 Apr 2009 13:26:17 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Lxldk-0002C5-4m for tramp-devel@mail.freesoftware.fsf.org; Sat, 25 Apr 2009 13:26:16 -0400 Original-Received: from [140.186.70.13] (port=43180 helo=mail.fsf.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Lxldj-0002Bu-RK for tramp-devel@mail.freesoftware.fsf.org; Sat, 25 Apr 2009 13:26:11 -0400 Original-Received: from mail.gmx.net ([213.165.64.20]:55433) by mail.fsf.org with smtp (Exim 4.69) (envelope-from ) id 1Lxldj-00020P-5x for tramp-devel@mail.freesoftware.fsf.org; Sat, 25 Apr 2009 13:26:11 -0400 Original-Received: (qmail invoked by alias); 25 Apr 2009 17:26:07 -0000 Original-Received: from brln-4db91779.pool.einsundeins.de (EHLO magdalene.local) [77.185.23.121] by mail.gmx.net (mp053) with SMTP; 25 Apr 2009 19:26:07 +0200 X-Authenticated: #3708877 X-Provags-ID: V01U2FsdGVkX18dBXJMmlodGc4NLm95MAMTWVvku2Mc7uraHzKCto p56qSrdMQnK8EV In-Reply-To: <86skjz5a8v.fsf@lifelogs.com> (Ted Zlatanov's message of "Thu, 23 Apr 2009 16:30:08 -0500") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.92 (gnu/linux) X-Y-GMX-Trusted: 0 X-FuHaFi: 0.52 X-detected-operating-system: by mail.fsf.org: GNU/Linux 2.6 (newer, 3) X-BeenThere: tramp-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: tramp-devel.gnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: tramp-devel-bounces+tramp=quimby.gnus.org@gnu.org Errors-To: tramp-devel-bounces+tramp=quimby.gnus.org@gnu.org Xref: news.gmane.org gmane.emacs.tramp:6827 gmane.emacs.gnus.general:68493 Archived-At: --=-=-= Content-Transfer-Encoding: 8bit Ted Zlatanov writes: > I made many other fixes so please use the attached file as a baseline if > you want to submit patches for any of the issues I listed before, or any > new issues you notice. It's getting close to usable. I've started to play with it. First error: Debugger entered--Lisp error: (wrong-number-of-arguments #[nil "ŠdbˆÀÁÂÃ#… " nil t delete-char 1] 4 ("/usr/local/share/emacs/23.0.92/lisp/gnus/nnheader.elc" . 25599)] 1) nnheader-ms-strip-cr("X-Tramp-Imap: *scratch* \nFrom: Tramp-Imap \nTo: Tramp-Imap \nSubject: tramp-imap-subject-marker fstab \nDate: Sat, 25 Apr 2009 19:08:13 +0200 \nMessage-ID: <87prf04q6a.fsf@gmx.de> \n \n") tramp-imap-get-message-headers(1) (nnheader-ms-strip-cr (tramp-imap-get-message-headers msgs)) (let ((headers ...)) (when (string-match "^X-Tramp-IMAP: \\(.+\\)" headers) (match-string 1 headers))) tramp-imap-get-message-x-tramp-imap(1) (setq sname (tramp-imap-get-message-x-tramp-imap msg)) (while --cl-dolist-temp-- (setq msg (car --cl-dolist-temp--)) (setq sname (tramp-imap-get-message-x-tramp-imap msg)) (when (and sname ...) (push ... res) (tramp-debug-message vec "found message %s: %s" msg ...)) (setq --cl-dolist-temp-- (cdr --cl-dolist-temp--))) (let ((--cl-dolist-temp-- ...) msg) (while --cl-dolist-temp-- (setq msg ...) (setq sname ...) (when ... ... ...) (setq --cl-dolist-temp-- ...)) nil) (catch (quote --cl-block-nil--) (let (... msg) (while --cl-dolist-temp-- ... ... ... ...) nil)) (cl-block-wrapper (catch (quote --cl-block-nil--) (let ... ... nil))) (block nil (let (... msg) (while --cl-dolist-temp-- ... ... ... ...) nil)) (dolist (msg (imap-search ...)) (setq sname (tramp-imap-get-message-x-tramp-imap msg)) (when (and sname ...) (push ... res) (tramp-debug-message vec "found message %s: %s" msg ...))) (let (sname) (tramp-debug-message vec "looking for '%s'" search-name) (dolist (msg ...) (setq sname ...) (when ... ... ...))) (if (and name (imap-mailbox-select mbox)) (let (sname) (tramp-debug-message vec "looking for '%s'" search-name) (dolist ... ... ...)) (tramp-error vec (quote none) "bad name %s or mailbox %s" name mbox)) (let* ((mbox ...) (name ...) (truename ...) (search-name ...) res) (tramp-debug-message vec "selecting mbox %s" mbox) (if (and name ...) (let ... ... ...) (tramp-error vec ... "bad name %s or mailbox %s" name mbox)) res) (save-current-buffer (set-buffer (tramp-imap-buffer vec)) (let* (... ... ... ... res) (tramp-debug-message vec "selecting mbox %s" mbox) (if ... ... ...) res)) (with-current-buffer (tramp-imap-buffer vec) (let* (... ... ... ... res) (tramp-debug-message vec "selecting mbox %s" mbox) (if ... ... ...) res)) tramp-imap-get-file-entries(["imap" "albinus" "localhost" "/INBOX.test"]) (car (tramp-imap-get-file-entries v)) (cdr (car (tramp-imap-get-file-entries v))) (progn (cdr (car ...))) (setq value (progn (cdr ...))) (progn (setq value (progn ...)) (tramp-set-file-property v localname (format "file-attributes-%s" id-format) value)) (if (eq value (quote undef)) (progn (setq value ...) (tramp-set-file-property v localname ... value))) (when (eq value (quote undef)) (setq value (progn ...)) (tramp-set-file-property v localname (format "file-attributes-%s" id-format) value)) (let ((value ...)) (when (eq value ...) (setq value ...) (tramp-set-file-property v localname ... value)) value) (if (file-name-absolute-p localname) (let (...) (when ... ... ...) value) (cdr (car ...))) (with-file-property v localname (format "file-attributes-%s" id-format) (cdr (car ...))) (let* ((v ...) (method ...) (user ...) (host ...) (localname ...)) (with-file-property v localname (format "file-attributes-%s" id-format) (cdr ...))) (with-parsed-tramp-file-name (expand-file-name filename) nil (with-file-property v localname (format "file-attributes-%s" id-format) (cdr ...))) tramp-imap-handle-file-attributes("/imap:albinus@localhost:/INBOX.test") apply(tramp-imap-handle-file-attributes "/imap:albinus@localhost:/INBOX.test") (progn (apply (cdr fn) args)) (unwind-protect (progn (apply ... args)) (set-match-data save-match-data-internal (quote evaporate))) (let ((save-match-data-internal ...)) (unwind-protect (progn ...) (set-match-data save-match-data-internal ...))) (save-match-data (apply (cdr fn) args)) (if fn (save-match-data (apply ... args)) (tramp-run-real-handler operation args)) (let ((fn ...)) (if fn (save-match-data ...) (tramp-run-real-handler operation args))) tramp-imap-file-name-handler(file-attributes "/imap:albinus@localhost:/INBOX.test") apply(tramp-imap-file-name-handler file-attributes "/imap:albinus@localhost:/INBOX.test") (cond ((and completion ... ...) t) ((and completion ... ...) filename) (foreign (apply foreign operation args)) (t (tramp-run-real-handler operation args))) (let* ((v ...) (method ...) (user ...) (host ...) (localname ...)) (cond (... t) (... filename) (foreign ...) (t ...))) (with-parsed-tramp-file-name filename nil (cond (... t) (... filename) (foreign ...) (t ...))) (let* ((filename ...) (completion ...) (foreign ...)) (with-parsed-tramp-file-name filename nil (cond ... ... ... ...))) (progn (let* (... ... ...) (with-parsed-tramp-file-name filename nil ...))) (unwind-protect (progn (let* ... ...)) (set-match-data save-match-data-internal (quote evaporate))) (let ((save-match-data-internal ...)) (unwind-protect (progn ...) (set-match-data save-match-data-internal ...))) (save-match-data (let* (... ... ...) (with-parsed-tramp-file-name filename nil ...))) (if tramp-mode (save-match-data (let* ... ...)) (tramp-run-real-handler operation args)) tramp-file-name-handler(file-attributes "/imap:albinus@localhost:/INBOX.test") file-attributes("/imap:albinus@localhost:/INBOX.test") (car (file-attributes filename)) (let ((x ...)) (when (stringp x) (if ... ... x))) (let* ((v ...) (method ...) (user ...) (host ...) (localname ...)) (let (...) (when ... ...))) (with-parsed-tramp-file-name filename nil (let (...) (when ... ...))) tramp-handle-file-symlink-p("/imap:albinus@localhost:/INBOX.test") apply(tramp-handle-file-symlink-p "/imap:albinus@localhost:/INBOX.test") (progn (apply (cdr fn) args)) (unwind-protect (progn (apply ... args)) (set-match-data save-match-data-internal (quote evaporate))) (let ((save-match-data-internal ...)) (unwind-protect (progn ...) (set-match-data save-match-data-internal ...))) (save-match-data (apply (cdr fn) args)) (if fn (save-match-data (apply ... args)) (tramp-run-real-handler operation args)) (let ((fn ...)) (if fn (save-match-data ...) (tramp-run-real-handler operation args))) tramp-imap-file-name-handler(file-symlink-p "/imap:albinus@localhost:/INBOX.test") apply(tramp-imap-file-name-handler file-symlink-p "/imap:albinus@localhost:/INBOX.test") (cond ((and completion ... ...) t) ((and completion ... ...) filename) (foreign (apply foreign operation args)) (t (tramp-run-real-handler operation args))) (let* ((v ...) (method ...) (user ...) (host ...) (localname ...)) (cond (... t) (... filename) (foreign ...) (t ...))) (with-parsed-tramp-file-name filename nil (cond (... t) (... filename) (foreign ...) (t ...))) (let* ((filename ...) (completion ...) (foreign ...)) (with-parsed-tramp-file-name filename nil (cond ... ... ... ...))) (progn (let* (... ... ...) (with-parsed-tramp-file-name filename nil ...))) (unwind-protect (progn (let* ... ...)) (set-match-data save-match-data-internal (quote evaporate))) (let ((save-match-data-internal ...)) (unwind-protect (progn ...) (set-match-data save-match-data-internal ...))) (save-match-data (let* (... ... ...) (with-parsed-tramp-file-name filename nil ...))) (if tramp-mode (save-match-data (let* ... ...)) (tramp-run-real-handler operation args)) tramp-file-name-handler(file-symlink-p "/imap:albinus@localhost:/INBOX.test") file-symlink-p("/imap:albinus@localhost:/INBOX.test") file-truename("/imap:albinus@localhost:/INBOX.test" (98) (nil)) file-truename("/imap:albinus@localhost:/INBOX.test/bbb") apply(file-truename "/imap:albinus@localhost:/INBOX.test/bbb") (let* ((inhibit-file-name-handlers ...) (inhibit-file-name-operation operation)) (apply operation args)) tramp-run-real-handler(file-truename ("/imap:albinus@localhost:/INBOX.test/bbb")) (if fn (save-match-data (apply ... args)) (tramp-run-real-handler operation args)) (let ((fn ...)) (if fn (save-match-data ...) (tramp-run-real-handler operation args))) tramp-imap-file-name-handler(file-truename "/imap:albinus@localhost:/INBOX.test/bbb") apply(tramp-imap-file-name-handler file-truename "/imap:albinus@localhost:/INBOX.test/bbb") (cond ((and completion ... ...) t) ((and completion ... ...) filename) (foreign (apply foreign operation args)) (t (tramp-run-real-handler operation args))) (let* ((v ...) (method ...) (user ...) (host ...) (localname ...)) (cond (... t) (... filename) (foreign ...) (t ...))) (with-parsed-tramp-file-name filename nil (cond (... t) (... filename) (foreign ...) (t ...))) (let* ((filename ...) (completion ...) (foreign ...)) (with-parsed-tramp-file-name filename nil (cond ... ... ... ...))) (progn (let* (... ... ...) (with-parsed-tramp-file-name filename nil ...))) (unwind-protect (progn (let* ... ...)) (set-match-data save-match-data-internal (quote evaporate))) (let ((save-match-data-internal ...)) (unwind-protect (progn ...) (set-match-data save-match-data-internal ...))) (save-match-data (let* (... ... ...) (with-parsed-tramp-file-name filename nil ...))) (if tramp-mode (save-match-data (let* ... ...)) (tramp-run-real-handler operation args)) tramp-file-name-handler(file-truename "/imap:albinus@localhost:/INBOX.test/bbb") file-truename("/imap:albinus@localhost:/INBOX.test/bbb") set-visited-file-name("/imap:localhost:INBOX.test/bbb" nil) write-file("/imap:localhost:INBOX.test/bbb" t) call-interactively(write-file nil nil) I'm using gnus as built in GNU Emacs 23.0.92. `nnheader-ms-strip-cr' has no argument there. You use by default 'ssl for connection. Can we expect this to be the standard? Or shall we let the user decide, for example by two methods "imap" and "imaps"? I've also applied some few patches, you might check. See appended. > Thanks > Ted Best regards, Michael. --=-=-= Content-Type: text/x-patch Content-Disposition: attachment *** /home/albinus/lisp/tramp-imap.el.~1~ 2009-04-25 18:27:52.000000000 +0200 --- /home/albinus/lisp/tramp-imap.el 2009-04-25 19:03:27.000000000 +0200 *************** *** 261,269 **** ;; ... and add it to the method list. (add-to-list 'tramp-methods (cons tramp-imap-method nil)) - ;; ... and add it to the method list. - (add-to-list 'tramp-methods (cons tramp-imap-method nil)) - ;; Add a default for `tramp-default-user-alist'. Default is the local user. (add-to-list 'tramp-default-user-alist `(,tramp-imap-method nil ,(user-login-name))) --- 261,266 ---- *************** *** 336,354 **** "Alist of handler functions for Tramp IMAP method. Operations not mentioned here will be handled by the default Emacs primitives.") - (defgroup tramp-imap nil - "Tramp over IMAP configuration." - :group 'applications) - (defcustom tramp-imap-subject-marker "tramp-imap-subject-marker" "The subject marker that Tramp-Imap will use." :type 'string ! :group 'tramp-imap) (defcustom tramp-imap-passphrase "my passphrase" "The passphrase that Tramp-Imap will use. TODO: allow function calls, etc. here" :type 'string ! :group 'tramp-imap) (defun tramp-imap-file-name-p (filename) "Check if it's a filename for IMAP protocol." --- 333,347 ---- "Alist of handler functions for Tramp IMAP method. Operations not mentioned here will be handled by the default Emacs primitives.") (defcustom tramp-imap-subject-marker "tramp-imap-subject-marker" "The subject marker that Tramp-Imap will use." :type 'string ! :group 'tramp) (defcustom tramp-imap-passphrase "my passphrase" "The passphrase that Tramp-Imap will use. TODO: allow function calls, etc. here" :type 'string ! :group 'tramp) (defun tramp-imap-file-name-p (filename) "Check if it's a filename for IMAP protocol." *************** *** 410,416 **** (save-match-data (let ((entries (with-file-property v localname "file-entries" ! (tramp-imap-get-file-entries v localname)))) (mapcar (lambda (x) (list --- 403,409 ---- (save-match-data (let ((entries (with-file-property v localname "file-entries" ! (tramp-imap-get-file-entries v)))) (mapcar (lambda (x) (list *************** *** 421,431 **** ;;; (tramp-imap-get-file-entries (tramp-dissect-file-name "/imap:blockstar.com:/INBOX.test/fstab") t) ! (defun tramp-imap-get-file-entries (vec localname &optional exact) "Read entries returned by IMAP server. EXACT limits to exact matches. Result is a list of (LOCALNAME LINK COUNT UID GID ATIME MTIME CTIME SIZE MODE WEIRD INODE DEVICE)." ! (tramp-debug-message vec "working on %s" localname) (with-current-buffer (tramp-imap-buffer vec) (let* ((mbox (tramp-imap-file-name-mailbox vec)) (name (tramp-imap-file-name-name vec)) --- 414,424 ---- ;;; (tramp-imap-get-file-entries (tramp-dissect-file-name "/imap:blockstar.com:/INBOX.test/fstab") t) ! (defun tramp-imap-get-file-entries (vec &optional exact) "Read entries returned by IMAP server. EXACT limits to exact matches. Result is a list of (LOCALNAME LINK COUNT UID GID ATIME MTIME CTIME SIZE MODE WEIRD INODE DEVICE)." ! (tramp-debug-message vec "working on %s" (tramp-file-name-localname vec)) (with-current-buffer (tramp-imap-buffer vec) (let* ((mbox (tramp-imap-file-name-mailbox vec)) (name (tramp-imap-file-name-name vec)) *************** *** 516,522 **** (let ((point (point)) size data) (tramp-message v 4 "Fetching file %s..." filename) ! (let* ((found (tramp-imap-get-file-entries v filename)) ;; inode is the message UID; we use the first message found (uid (nth 11 (nth 0 found)))) (when found --- 509,515 ---- (let ((point (point)) size data) (tramp-message v 4 "Fetching file %s..." filename) ! (let* ((found (tramp-imap-get-file-entries v)) ;; inode is the message UID; we use the first message found (uid (nth 11 (nth 0 found)))) (when found *************** *** 547,553 **** "Like `file-attributes' for Tramp files." (with-parsed-tramp-file-name (expand-file-name filename) nil (with-file-property v localname (format "file-attributes-%s" id-format) ! (cdr (car (tramp-imap-get-file-entries v localname)))))) (defun tramp-imap-handle-file-executable-p (filename) "Like `file-executable-p' for Tramp files. False for IMAP." --- 540,546 ---- "Like `file-attributes' for Tramp files." (with-parsed-tramp-file-name (expand-file-name filename) nil (with-file-property v localname (format "file-attributes-%s" id-format) ! (cdr (car (tramp-imap-get-file-entries v)))))) (defun tramp-imap-handle-file-executable-p (filename) "Like `file-executable-p' for Tramp files. False for IMAP." *************** *** 651,664 **** ;;; (with-current-buffer (tramp-imap-buffer (tramp-dissect-file-name "/imap:blockstar.com:/INBOX.test/new")) (tramp-imap-get-message-subject 24)) (defun tramp-imap-get-message-subject (msgs) "Get message subject over IMAP." ! (let ((allsubject ! (nnheader-ms-strip-cr ! (nth 2 (nth 0 (imap-fetch msgs ! "BODY[HEADER.FIELDS (SUBJECT)]" 'BODYDETAIL)))))) ! (when (string-match --=-=-= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Tramp-devel mailing list Tramp-devel@gnu.org http://lists.gnu.org/mailman/listinfo/tramp-devel --=-=-=--