summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorClément Lassieur <clement.lassieur@parrot.com>2018-12-26 15:17:42 +0100
committerClément Lassieur <clement.lassieur@parrot.com>2018-12-27 18:53:48 +0100
commit37a7e62497fac4cd315cdb8dfbc15b175625b158 (patch)
tree2b411f0943916aab2d28e9fb647d2295bc45ecb5
parent9f876417fd59dab31492b3c15795f6148ba5fbc7 (diff)
downloadpackages-37a7e62497fac4cd315cdb8dfbc15b175625b158.tar.gz
add emacs-dropbox
-rw-r--r--fix-directory-file-name.patch30
-rw-r--r--fix-encoding.patch34
-rw-r--r--fix-expand-file-name.patch61
-rw-r--r--fix-file-name-directory.patch27
-rw-r--r--fix-missing-date.patch25
-rw-r--r--og/emacs.scm32
6 files changed, 209 insertions, 0 deletions
diff --git a/fix-directory-file-name.patch b/fix-directory-file-name.patch
new file mode 100644
index 0000000..116fd9b
--- /dev/null
+++ b/fix-directory-file-name.patch
@@ -0,0 +1,30 @@
+From 039acb0d710ed719d2b1b395bd4207f26097b854 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Cl=C3=A9ment=20Lassieur?= <clement.lassieur@parrot.com>
+Date: Thu, 27 Dec 2018 16:23:49 +0100
+Subject: [PATCH] fix directory-file-name
+
+---
+ dropbox.el | 7 +++----
+ 1 file changed, 3 insertions(+), 4 deletions(-)
+
+diff --git a/dropbox.el b/dropbox.el
+index b737de7..732af78 100644
+--- a/dropbox.el
++++ b/dropbox.el
+@@ -379,10 +379,9 @@ dropbox-like files (/db:/something is transformed into /db:something)."
+
+ (defun dropbox-handle-directory-file-name (directory)
+ "Remove the final slash from a directory name"
+-
+- (if (eq (aref directory (1- (length directory))) ?/)
+- (substring directory 0 -1)
+- directory))
++ (concat "/db:" (dropbox-run-real-handler
++ 'directory-file-name
++ (list (dropbox-strip-prefix directory)))))
+
+ (defun dropbox-handle-file-name-as-directory (directory)
+ "Remove the final slash from a directory name"
+--
+2.19.1
+
diff --git a/fix-encoding.patch b/fix-encoding.patch
new file mode 100644
index 0000000..620308b
--- /dev/null
+++ b/fix-encoding.patch
@@ -0,0 +1,34 @@
+From a3036bbfd76742a2703fe60c9f1b57ffdf088e4c Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Cl=C3=A9ment=20Lassieur?= <clement.lassieur@parrot.com>
+Date: Wed, 26 Dec 2018 18:36:25 +0100
+Subject: [PATCH] Fix encoding
+
+---
+ dropbox.el | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/dropbox.el b/dropbox.el
+index cf07774..a76cfe4 100644
+--- a/dropbox.el
++++ b/dropbox.el
+@@ -760,7 +760,7 @@ are /db: files, but otherwise is not necessarily atomic."
+ (erase-buffer))
+ (let* ((path (encode-coding-string (dropbox--sanitize-path (dropbox-strip-prefix filename)) 'utf-8))
+ (contents (dropbox-request 'download nil (json-encode `(("path" . ,path))))))
+- (insert contents)))
++ (insert (decode-coding-string contents 'iso-latin-1-unix))))
+ (set-buffer-modified-p nil))
+ (when visit
+ (setf buffer-file-name filename)
+@@ -787,7 +787,7 @@ are /db: files, but otherwise is not necessarily atomic."
+ (if (not (file-exists-p filename))
+ (error "File to copy doesn't exist")
+ (with-temp-file newname
+- (set-buffer-file-coding-system 'raw-text)
++ (set-buffer-file-coding-system 'utf-8)
+ (dropbox-handle-insert-file-contents filename)))
+ newname))))
+
+--
+2.19.1
+
diff --git a/fix-expand-file-name.patch b/fix-expand-file-name.patch
new file mode 100644
index 0000000..491a8fb
--- /dev/null
+++ b/fix-expand-file-name.patch
@@ -0,0 +1,61 @@
+From 18b7b900901ec8cb4641ad96917d0fa8e2972fa9 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Cl=C3=A9ment=20Lassieur?= <clement.lassieur@parrot.com>
+Date: Thu, 27 Dec 2018 16:35:06 +0100
+Subject: [PATCH] fix expand-file-name
+
+---
+ dropbox.el | 38 ++++++++++++++++++++++++++------------
+ 1 file changed, 26 insertions(+), 12 deletions(-)
+
+diff --git a/dropbox.el b/dropbox.el
+index 443a8f3..b737de7 100644
+--- a/dropbox.el
++++ b/dropbox.el
+@@ -342,18 +342,32 @@ debugging but otherwise very intrusive."
+ (match-string 1 filename))
+ (t (substring filename 4))))
+
+-(defun dropbox-handle-expand-file-name (filename &optional default-directory)
+- "Return the canonicalized, absolute version of FILENAME"
+-
+- (if (or (file-name-absolute-p filename)
+- (not (dropbox-file-p default-directory)))
+- filename
+- (concat
+- dropbox-prefix
+- (substring
+- (expand-file-name filename
+- (concat "/" (dropbox-strip-prefix default-directory)))
+- 1))))
++(defun dropbox-remove-slash (filename)
++ "Transform /db:/notes into /db:notes."
++ (if (dropbox-file-p filename)
++ (if (string-match "^/db:/\\(.*\\)$" filename)
++ (concat dropbox-prefix (match-string 1 filename))
++ filename)
++ filename))
++
++(defun dropbox-run-real-handler (operation args)
++ "Invoke normal file name handler for OPERATION.
++First arg specifies the OPERATION, second arg is a list of arguments to
++pass to the OPERATION."
++ (let* ((inhibit-file-name-handlers
++ `(dropbox-handler
++ .
++ ,(and (eq inhibit-file-name-operation operation)
++ inhibit-file-name-handlers)))
++ (inhibit-file-name-operation operation))
++ (apply operation args)))
++
++(defun dropbox-handle-expand-file-name (filename &optional dir)
++ "Like the normal operation, except that slashes are removed from
++dropbox-like files (/db:/something is transformed into /db:something)."
++ (dropbox-run-real-handler 'expand-file-name
++ (list (dropbox-remove-slash filename)
++ (dropbox-remove-slash dir))))
+
+ (defun dropbox-handle-file-truename (filename)
+ filename)
+--
+2.19.1
+
diff --git a/fix-file-name-directory.patch b/fix-file-name-directory.patch
new file mode 100644
index 0000000..d1804c9
--- /dev/null
+++ b/fix-file-name-directory.patch
@@ -0,0 +1,27 @@
+From 9fbb963784c1906a620efced20d6a57eb5c6be12 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Cl=C3=A9ment=20Lassieur?= <clement.lassieur@parrot.com>
+Date: Thu, 27 Dec 2018 15:07:54 +0100
+Subject: [PATCH] fix file-name-directory
+
+---
+ dropbox.el | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/dropbox.el b/dropbox.el
+index 0c2afa4..443a8f3 100644
+--- a/dropbox.el
++++ b/dropbox.el
+@@ -386,7 +386,9 @@ debugging but otherwise very intrusive."
+ (make-temp-name (concat "/tmp/dropbox-el-" (file-name-nondirectory buffer-file-name))))
+
+ (defun dropbox-handle-unhandled-file-name-directory (filename)
+- dropbox-prefix)
++ "Files like /db:something are not usable without the intervention of a file
++handler, thus return `nil'."
++ nil)
+
+ ;;; Predicates
+
+--
+2.19.1
+
diff --git a/fix-missing-date.patch b/fix-missing-date.patch
new file mode 100644
index 0000000..539795d
--- /dev/null
+++ b/fix-missing-date.patch
@@ -0,0 +1,25 @@
+From 6c1425a252bd6dd022e471e6f6933cf910820439 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Cl=C3=A9ment=20Lassieur?= <clement.lassieur@parrot.com>
+Date: Wed, 26 Dec 2018 15:38:01 +0100
+Subject: [PATCH] Fix missing date
+
+---
+ dropbox.el | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/dropbox.el b/dropbox.el
+index 0441fe7..cf07774 100644
+--- a/dropbox.el
++++ b/dropbox.el
+@@ -470,7 +470,7 @@ FILENAME names a directory"
+ (dropbox--metadata (dropbox-strip-prefix filename))))
+ ;; (if (dropbox-error-p resp)
+ ;; nil
+- (let ((date (date-to-time (alist-get 'client_modified resp)))
++ (let ((date (date-to-time (or (alist-get 'client_modified resp) "Mon, 01 Jan 0000 00:00:00 +0000")))
+ (folder (string= "folder" (alist-get '.tag resp)))) ;; Is dir?
+ (list folder
+ 1 ; Number of links
+--
+2.19.1
+
diff --git a/og/emacs.scm b/og/emacs.scm
index 5ca44ae..227b9de 100644
--- a/og/emacs.scm
+++ b/og/emacs.scm
@@ -9,6 +9,38 @@
#:use-module (gnu packages autotools)
#:use-module (gnu packages emacs))
+;; issues:
+;; - force encoding to iso-latin-1-unix (better than nothing)
+;; - copy/rename from dired doesn't work (but plain use of the copy-file and
+;; rename-file functions works)
+;; - M-x shell with "/db:" as default-directory spawns a shell in '/' and
+;; its default-directory ("/db:") won't change
+(define-public emacs-dropbox
+ (package
+ (name "emacs-dropbox")
+ (version "20181208.2248")
+ (source
+ (origin (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/pavpanchekha/dropbox.el")
+ (commit "9fcb70c3e4e32b1612644d65e3b98f00255a40d4")))
+ (file-name (string-append name "-" version "-checkout"))
+ (sha256
+ (base32
+ "0a26cfv7ayalwgg78jm4r6m2wv1wjqy4s0y1lv6j8zv193mqzgdz"))
+ (patches (search-patches "fix-missing-date.patch"
+ "fix-encoding.patch"
+ "fix-expand-file-name.patch"
+ "fix-directory-file-name.patch"
+ "fix-file-name-directory.patch"))))
+ (propagated-inputs
+ `(("emacs-request" ,emacs-request)))
+ (build-system emacs-build-system)
+ (home-page "")
+ (synopsis "")
+ (description "")
+ (license license:gpl3+)))
+
(define-public emacs-alect-themes
(package
(name "emacs-alect-themes")