[elpa] externals/debbugs 4c65821274: * debbugs-gnu.el (debbugs-gnu-default-packages): Add "automake-patches".
branch: externals/debbugs commit 4c658212748aad823db17aba7d2d061c52b37ee5 Author: Michael Albinus Commit: Michael Albinus * debbugs-gnu.el (debbugs-gnu-default-packages): Add "automake-patches". --- debbugs-gnu.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/debbugs-gnu.el b/debbugs-gnu.el index 526e2ea710..320fdf7f88 100644 --- a/debbugs-gnu.el +++ b/debbugs-gnu.el @@ -289,6 +289,7 @@ If nil, the value of `send-mail-function' is used instead." (const "anubis") (const "auctex") (const "automake") + (const "automake-patches") (const "cc-mode") (const "coreutils") (const "cppi") @@ -323,7 +324,7 @@ If nil, the value of `send-mail-function' is used instead." 'help-echo "This is a pseudo package for test.")) (const "vc-dwim") (const "woodchuck")) - :version "27.2") + :version "28.1") (defconst debbugs-gnu-all-packages (mapcar #'cadr (cdr (get 'debbugs-gnu-default-packages 'custom-type)))
[elpa] externals/org 9b650938e7 13/31: org-persist: Provide human readable access time and make sure it exist
branch: externals/org commit 9b650938e798092272023351519a8944d8804cd7 Author: Ihor Radchenko Commit: Ihor Radchenko org-persist: Provide human readable access time and make sure it exist * lisp/org-persist.el (org-persist--storage-version): Bump version. (org-persist-read:generic): (org-persist-load:generic): (org-persist-write:generic): Save access time in human-readable form. --- lisp/org-persist.el | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lisp/org-persist.el b/lisp/org-persist.el index 664111a7ab..524c438e7d 100644 --- a/lisp/org-persist.el +++ b/lisp/org-persist.el @@ -102,7 +102,7 @@ (require 'org-id) (require 'xdg nil t) -(defconst org-persist--storage-version "2.1" +(defconst org-persist--storage-version "2.2" "Persistent storage layout version.") (defgroup org-persist nil @@ -422,6 +422,7 @@ COLLECTION is the plist holding data collectin." `(let* ((c (org-persist--normalize-container ,container)) (read-func-symbol (intern (format "org-persist-read:%s" (car c) (setf ,collection (plist-put ,collection :last-access (float-time))) + (setf ,collection (plist-put ,collection :last-access-hr (format-time-string "%FT%T%z" (float-time (unless (fboundp read-func-symbol) (error "org-persist: Read function %s not defined" read-func-symbol)) @@ -469,6 +470,7 @@ COLLECTION is the plist holding data collectin." `(let* ((container (org-persist--normalize-container ,container)) (load-func-symbol (intern (format "org-persist-load:%s" (car container) (setf ,collection (plist-put ,collection :last-access (float-time))) + (setf ,collection (plist-put ,collection :last-access-hr (format-time-string "%FT%T%z" (float-time (unless (fboundp load-func-symbol) (error "org-persist: Load function %s not defined" load-func-symbol)) @@ -516,6 +518,8 @@ COLLECTION is the plist holding data collectin." "Write CONTAINER in COLLECTION." `(let* ((c (org-persist--normalize-container ,container)) (write-func-symbol (intern (format "org-persist-write:%s" (car c) + (setf ,collection (plist-put ,collection :last-access (float-time))) + (setf ,collection (plist-put ,collection :last-access-hr (format-time-string "%FT%T%z" (float-time (unless (fboundp write-func-symbol) (error "org-persist: Write function %s not defined" write-func-symbol))
[elpa] externals/org 703df9310a 07/31: org-persist: Cleanup on removal and version mismatch
branch: externals/org commit 703df9310acdfc57b1a6e3028ea923f6a71587b4 Author: Ihor Radchenko Commit: Ihor Radchenko org-persist: Cleanup on removal and version mismatch * lisp/org-persist.el (org-persist--remove-from-index): (org-persist-load:index): Garbage collect caches. --- lisp/org-persist.el | 6 ++ 1 file changed, 6 insertions(+) diff --git a/lisp/org-persist.el b/lisp/org-persist.el index 85908db788..0dabb54fe8 100644 --- a/lisp/org-persist.el +++ b/lisp/org-persist.el @@ -328,6 +328,7 @@ Return PLIST." (when existing (org-persist-collection-let collection (dolist (cont (cons container container)) + (org-persist-gc:generic cont collection) (remhash (cons cont associated) org-persist--index-hash) (when path (remhash (cons cont (list :file path)) org-persist--index-hash)) (when inode (remhash (cons cont (list :inode inode)) org-persist--index-hash)) @@ -494,6 +495,11 @@ COLLECTION is the plist holding data collectin." (if org-persist--index (mapc (lambda (collection) (org-persist--add-to-index collection 'hash)) org-persist--index) (setq org-persist--index nil) + (when (file-exists-p org-persist-directory) +(dolist (file (directory-files org-persist-directory 'absolute "^[^.][^.]")) + (if (file-directory-p file) + (delete-directory file t) +(delete-file file (plist-put (org-persist--get-collection container) :expiry 'never (defun org-persist--load-index ()
[elpa] externals/org edd7f2962f 01/31: org-persist: Reimplement using more generic approach
branch: externals/org commit edd7f2962fe146805ab275974274596f994ebd9f Author: Ihor Radchenko Commit: Ihor Radchenko org-persist: Reimplement using more generic approach --- lisp/org-element.el | 70 ++-- lisp/org-persist.el | 936 ++-- lisp/org.el | 7 +- 3 files changed, 726 insertions(+), 287 deletions(-) diff --git a/lisp/org-element.el b/lisp/org-element.el index b82475a14e..d556ab2eed 100644 --- a/lisp/org-element.el +++ b/lisp/org-element.el @@ -7054,43 +7054,53 @@ The element is: %S\n The real element is: %S\n Cache around :begin:\n%S\n%S\n%S" ;;; Cache persistance -(defun org-element--cache-persist-before-write (var &optional buffer) +(defun org-element--cache-persist-before-write (container &optional associated) "Sync cache before saving." - (when (and org-element-use-cache - buffer - org-element-cache-persistent - (eq var 'org-element--cache) - (derived-mode-p 'org-mode) - org-element--cache) -(with-current-buffer buffer - ;; Cleanup cache request keys to avoid collisions during next - ;; Emacs session. - (avl-tree-mapc - (lambda (el) - (org-element-put-property el :org-element--cache-sync-key nil)) - org-element--cache) - (org-with-wide-buffer - (org-element-at-point (point-max -nil)) - -(defun org-element--cache-persist-before-read (var &optional buffer) + (when (equal container '("elisp" org-element--cache)) +(if (and org-element-use-cache + (plist-get associated :file) + (get-file-buffer (plist-get associated :file)) + org-element-cache-persistent) +(with-current-buffer (get-file-buffer (plist-get associated :file)) + (if (and (derived-mode-p 'org-mode) + org-element--cache) + (progn +;; Cleanup cache request keys to avoid collisions during next +;; Emacs session. +(avl-tree-mapc + (lambda (el) + (org-element-put-property el :org-element--cache-sync-key nil)) + org-element--cache) +(org-with-wide-buffer + (org-element-at-point (point-max))) +nil) +'forbid)) + 'forbid))) + +(defun org-element--cache-persist-before-read (container &optional associated) "Avoid reading cache before Org mode is loaded." - (when (memq var '(org-element--cache org-element--headline-cache)) -(if (not buffer) 'forbid - (with-current-buffer buffer + (when (equal container '("elisp" org-element--cache)) +(if (not (and (plist-get associated :file) +(get-file-buffer (plist-get associated :file +'forbid + (with-current-buffer (get-file-buffer (plist-get associated :file)) (unless (and org-element-use-cache org-element-cache-persistent - (derived-mode-p 'org-mode)) + (derived-mode-p 'org-mode) + (equal (secure-hash 'md5 (current-buffer)) +(plist-get associated :hash))) 'forbid) -(defun org-element--cache-persist-after-read (var &optional buffer) +(defun org-element--cache-persist-after-read (container &optional associated) "Setup restored cache." - (with-current-buffer buffer -(when (and org-element-use-cache org-element-cache-persistent) - (when (and (eq var 'org-element--cache) org-element--cache) -(setq-local org-element--cache-size (avl-tree-size org-element--cache))) - (when (and (eq var 'org-element--headline-cache) org-element--headline-cache) -(setq-local org-element--headline-cache-size (avl-tree-size org-element--headline-cache)) + (when (and (plist-get associated :file) + (get-file-buffer (plist-get associated :file))) +(with-current-buffer (get-file-buffer (plist-get associated :file)) + (when (and org-element-use-cache org-element-cache-persistent) +(when (and (equal container '("elisp" org-element--cache)) org-element--cache) + (setq-local org-element--cache-size (avl-tree-size org-element--cache))) +(when (and (equal container '("elisp" org-element--headline-cache)) org-element--headline-cache) + (setq-local org-element--headline-cache-size (avl-tree-size org-element--headline-cache))) (add-hook 'org-persist-before-write-hook #'org-element--cache-persist-before-write) (add-hook 'org-persist-before-read-hook #'org-element--cache-persist-before-read) diff --git a/lisp/org-persist.el b/lisp/org-persist.el index 266c0a513e..9fee5f7936 100644 --- a/lisp/org-persist.el +++ b/lisp/org-persist.el @@ -24,6 +24,77 @@ ;; ;; This file implements persistant data storage across Emacs sessions. ;; Both global and buffer-local data can be stored. +;; +;; Most common data type is variable d
[elpa] externals/org ec787fb218 19/31: org-persist: Implement "file" and "url" containers linked to other file
branch: externals/org commit ec787fb218dab5eb30e8f004638078c70d5846b0 Author: Ihor Radchenko Commit: Ihor Radchenko org-persist: Implement "file" and "url" containers linked to other file * lisp/org-persist.el: Update commentary. (org-persist--storage-version): Bump storage version. (org-persist-write:file): (org-persist-write:url): Support optional container setting. --- lisp/org-persist.el | 41 ++--- 1 file changed, 26 insertions(+), 15 deletions(-) diff --git a/lisp/org-persist.el b/lisp/org-persist.el index f80a8e2c18..98d2f11afb 100644 --- a/lisp/org-persist.el +++ b/lisp/org-persist.el @@ -41,7 +41,13 @@ ;;has been removed. ;; 3. Temporarily cache a file, including TRAMP path to disk: ;;(org-persist-write '("file") "/path/to/file") -;; 4. Cache value of a Elisp variable to disk. The value will be +;; 4. Cache file or URL while some other file exists. +;;(org-persist-register '("url" "https://static.fsf.org/common/img/logo-new.png";) '(:file "/path to the other file") :expiry 'never) +;;(org-persist-write '("url" "https://static.fsf.org/common/img/logo-new.png";) '(:file "/path to the other file")) +;;or, if the other file is current buffer file +;;(org-persist-register '("url" "https://static.fsf.org/common/img/logo-new.png";) (current-buffer) :expiry 'never) +;;(org-persist-write '("url" "https://static.fsf.org/common/img/logo-new.png";) (current-buffer)) +;; 5. Cache value of a Elisp variable to disk. The value will be ;;saved and restored automatically (except buffer-local ;;variables). ;;;; Until `org-persist-default-expiry' @@ -54,11 +60,11 @@ ;;;; Save buffer-local variable preserving circular links: ;;(org-persist-register 'org-element--headline-cache (current-buffer) ;; :inherit 'org-element--cache) -;; 5. Load variable by side effects assigning variable symbol: +;; 6. Load variable by side effects assigning variable symbol: ;;(org-persist-load 'variable-symbol (current-buffer)) -;; 6. Version variable value: +;; 7. Version variable value: ;;(org-persist-register '(("elisp" variable-symbol) (version "2.0"))) -;; 7. Cancel variable persistence: +;; 8. Cancel variable persistence: ;;(org-persist-unregister 'variable-symbol 'all) ; in all buffers ;;(org-persist-unregister 'variable-symbol) ;; global variable ;;(org-persist-unregister 'variable-symbol (current-buffer)) ;; buffer-local @@ -120,6 +126,7 @@ ;;elisp variable data. ;; 2. ("file") :: Store a copy of the associated file preserving the ;;extension. +;;("file" "/path/to/a/file") :: Store a copy of the file in path. ;; 3. ("version" "version number") :: Version the data collection. ;; If the stored collection has different version than "version ;; number", disregard it. @@ -153,7 +160,7 @@ (declare-function org-at-heading-p "org" (&optional invisible-not-ok)) -(defconst org-persist--storage-version "2.2" +(defconst org-persist--storage-version "2.3" "Persistent storage layout version.") (defgroup org-persist nil @@ -603,35 +610,39 @@ COLLECTION is the plist holding data collectin." (defalias 'org-persist-write:version #'ignore) -(defun org-persist-write:file (_ collection) - "Write file container according to COLLECTION." +(defun org-persist-write:file (c collection) + "Write file container C according to COLLECTION." (org-persist-collection-let collection -(when (and path (file-exists-p path)) +(when (or (and path (file-exists-p path)) + (and (stringp (cadr c)) (file-exists-p (cadr c + (when (and (stringp (cadr c)) (file-exists-p (cadr c))) +(setq path (cadr c))) (let* ((persist-file (plist-get collection :persist-file)) (ext (file-name-extension path)) (file-copy (org-file-name-concat org-persist-directory - (format "%s-file.%s" persist-file ext + (format "%s-%s.%s" persist-file (md5 path) ext (unless (file-exists-p (file-name-directory file-copy)) (make-directory (file-name-directory file-copy) t)) (unless (file-exists-p file-copy) (copy-file path file-copy 'overwrite)) -(format "%s-file.%s" persist-file ext) +(format "%s-%s.%s" persist-file (md5 path) ext) -(defun org-persist-write:url (_ collection) - "Write url container according to COLLECTION." +(defun org-persist-write:url (c collection) + "Write url container C according to COLLECTION." (org-persist-collection-let collection -(when path +(when (or path (cadr c)) + (when (cadr c) (setq path (cadr c))) (let* ((persist-file (plist-get collection :persist-file)) (ext (file-name-extension path)) (file-copy (org-file-name-concat org-persist-directory -
[elpa] externals/org 38a681fdae 05/31: org-element-cache-reset: Do not persist caches for non-file buffers
branch: externals/org commit 38a681fdaeae697f64974952bad63fce40f59ceb Author: Ihor Radchenko Commit: Ihor Radchenko org-element-cache-reset: Do not persist caches for non-file buffers --- lisp/org-element.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lisp/org-element.el b/lisp/org-element.el index d556ab2eed..307b93b3fc 100644 --- a/lisp/org-element.el +++ b/lisp/org-element.el @@ -7125,7 +7125,8 @@ buffers." (when (not org-element-cache-persistent) (org-persist-unregister 'org-element--headline-cache (current-buffer)) (org-persist-unregister 'org-element--cache (current-buffer))) -(when org-element-cache-persistent +(when (and org-element-cache-persistent + (buffer-file-name (current-buffer))) (org-persist-register 'org-element--cache (current-buffer)) (org-persist-register 'org-element--headline-cache (current-buffer)
[elpa] externals/org 7c2d93560c 03/31: org-persist-default-expiry: Introduce and change default
branch: externals/org commit 7c2d93560c4b3f93271220aecee622d59c12873d Author: Ihor Radchenko Commit: Ihor Radchenko org-persist-default-expiry: Introduce and change default * lisp/org-persist.el: New customisation controlling default persist data expiry. Defaults to 30 days from last access. (org-persist-register): Change default value of `:expiry' key to `org-persist-default-expiry'. --- lisp/org-persist.el | 16 +++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/lisp/org-persist.el b/lisp/org-persist.el index 413c7790d8..7ac6940b0b 100644 --- a/lisp/org-persist.el +++ b/lisp/org-persist.el @@ -143,6 +143,20 @@ password prompts to log in." (number :tag "Keep not more than X files") (const :tag "Check if exist on remote" 'check-existence))) +(defcustom org-persist-default-expiry 30 + "Default expiry condition for persistent data. + +When this variable is `nil', all the data vanishes at the end of Emacs +session. When `never', the data never vanishes. When a number, the +data is deleted that number days after last access. When a function, +it should be a function returning non-nil when the data is expired. The +function will be called with a single argument - collection." + :group 'org-persist + :type '(choice (const :tag "Never" 'never) + (const :tag "Always" nil) + (number :tag "Keep N days") + (function :tag "Function"))) + (defconst org-persist-index-file "index" "File name used to store the data index.") @@ -571,7 +585,7 @@ COLLECTION is the plist holding data collectin." Public API -(cl-defun org-persist-register (container &optional associated &rest misc &key inherit &key (expiry 'never) &allow-other-keys) +(cl-defun org-persist-register (container &optional associated &rest misc &key inherit &key (expiry org-persist-default-expiry) &allow-other-keys) "Register CONTAINER in ASSOCIATED to be persistent across Emacs sessions. Optional key INHERIT makes CONTAINER dependent on another container. Such dependency means that data shared between variables will be
[elpa] externals/org 1084566322 08/31: Fix org-persist-unregister
branch: externals/org commit 10845663224be8973a832718e6bed1cd30b18b82 Author: Ihor Radchenko Commit: Ihor Radchenko Fix org-persist-unregister --- lisp/org-persist.el | 15 +-- 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/lisp/org-persist.el b/lisp/org-persist.el index 0dabb54fe8..6fbf67fe67 100644 --- a/lisp/org-persist.el +++ b/lisp/org-persist.el @@ -625,17 +625,20 @@ EXPIRY key has no effect when INHERIT is non-nil." "Unregister CONTAINER in ASSOCIATED to be persistent. When ASSOCIATED is `all', unregister CONTAINER everywhere." (unless org-persist--index (org-persist--load-index)) + (setq container (org-persist--normalize-container container)) + (setq associated (org-persist--normalize-associated associated)) (if (eq associated 'all) (mapc (lambda (collection) (when (member container (plist-get collection :container)) (org-persist-unregister container (plist-get collection :associated org-persist--index) -(let ((collection (org-persist--get-collection container associated))) - (if (= (length (plist-get collection :container)) 1) - (org-persist--remove-from-index collection) -(plist-put collection :container - (remove container (plist-get collection :container))) -(org-persist--add-to-index collection) +(let ((collection (org-persist--find-index `(:container ,container :associated ,associated + (when collection +(if (= (length (plist-get collection :container)) 1) +(org-persist--remove-from-index collection) + (plist-put collection :container + (remove container (plist-get collection :container))) + (org-persist--add-to-index collection)) (defun org-persist-read (container &optional associated hash-must-match load?) "Restore CONTAINER data for ASSOCIATED.
[elpa] externals/org d5fc159bf7 15/31: Fix compiler warnings
branch: externals/org commit d5fc159bf7d73db807b09cda1ca8d831966701e1 Author: Ihor Radchenko Commit: Ihor Radchenko Fix compiler warnings --- lisp/org-persist.el | 68 - 1 file changed, 36 insertions(+), 32 deletions(-) diff --git a/lisp/org-persist.el b/lisp/org-persist.el index 8c97ac3762..fad67e84c0 100644 --- a/lisp/org-persist.el +++ b/lisp/org-persist.el @@ -271,32 +271,45 @@ FORMAT and ARGS are passed to `message'." (- (float-time) start-time) "Writing to %S" file))) +(defmacro org-persist-gc:generic (container collection) + "Garbage collect CONTAINER data from COLLECTION." + `(let* ((c (org-persist--normalize-container ,container)) + (gc-func-symbol (intern (format "org-persist-gc:%s" (car c) + (unless (fboundp gc-func-symbol) + (error "org-persist: GC function %s not defined" + gc-func-symbol)) + (funcall gc-func-symbol c ,collection))) + Working with index (defmacro org-persist-collection-let (collection &rest body) "Bind container and associated from COLLECTION and execute BODY." (declare (debug (form body)) (indent 1)) - `(let* ((container (plist-get ,collection :container)) - (associated (plist-get ,collection :associated)) - (path (plist-get associated :file)) - (inode (plist-get associated :inode)) - (hash (plist-get associated :hash)) - (key (plist-get associated :key))) - ,@body)) + `(with-no-warnings + ;; FIXME: We only need to suppress warnings about unused + ;; let-bindings. However, it is unclear how to achieve it with + ;; `with-suppressed-warnings'. + (let* ((container (plist-get ,collection :container)) +(associated (plist-get ,collection :associated)) +(path (plist-get associated :file)) +(inode (plist-get associated :inode)) +(hash (plist-get associated :hash)) +(key (plist-get associated :key))) + ,@body))) (defun org-persist--find-index (collection) - "Find COLLECTION in `org-persist--index'." - (org-persist-collection-let collection -(and org-persist--index-hash - (catch :found - (dolist (cont (cons container container)) - (let (r) - (setq r (or (gethash (cons cont associated) org-persist--index-hash) - (and path (gethash (cons cont (list :file path)) org-persist--index-hash)) - (and inode (gethash (cons cont (list :inode inode)) org-persist--index-hash)) - (and hash (gethash (cons cont (list :hash hash)) org-persist--index-hash)) - (and key (gethash (cons cont (list :key key)) org-persist--index-hash - (when r (throw :found r +"Find COLLECTION in `org-persist--index'." +(org-persist-collection-let collection + (and org-persist--index-hash + (catch :found + (dolist (cont (cons container container)) + (let (r) + (setq r (or (gethash (cons cont associated) org-persist--index-hash) + (and path (gethash (cons cont (list :file path)) org-persist--index-hash)) + (and inode (gethash (cons cont (list :inode inode)) org-persist--index-hash)) + (and hash (gethash (cons cont (list :hash hash)) org-persist--index-hash)) + (and key (gethash (cons cont (list :key key)) org-persist--index-hash + (when r (throw :found r (defun org-persist--add-to-index (collection &optional hash-only) "Add or update COLLECTION in `org-persist--index'. @@ -537,8 +550,8 @@ COLLECTION is the plist holding data collectin." (defalias 'org-persist-write:version #'ignore) -(defun org-persist-write:file (container collection) - "Write file CONTAINER according to COLLECTION." +(defun org-persist-write:file (_ collection) + "Write file container according to COLLECTION." (org-persist-collection-let collection (when (and path (file-exists-p path)) (let* ((persist-file (plist-get collection :persist-file)) @@ -552,8 +565,8 @@ COLLECTION is the plist holding data collectin." (copy-file path file-copy 'overwrite)) (format "%s-file.%s" persist-file ext) -(defun org-persist-write:url (container collection) - "Write url CONTAINER according to COLLECTION." +(defun org-persist-write:url (_ collection) + "Write url container according to COLLECTION." (org-persist-collection-let collection (when path (let* ((persist-file (plist-get collection :persist-file)) @@ -746,15 +759,6 @@ Do nothing in an indirect buffer." (unless (buffer-base-buffer (current-buffer)) (org-persist-write-all (current-buffer -(defmacro org-persist-gc:generic (container collection) - "Garbage collect CONTAINER data from COLLECTION." - `(let* ((c (org-persist--normalize-c
[elpa] externals/org 1869a37a2c 10/31: Fix org-persist--remove-from-index
branch: externals/org commit 1869a37a2c72dd799a9b8b3d4b18c535a910557b Author: Ihor Radchenko Commit: Ihor Radchenko Fix org-persist--remove-from-index --- lisp/org-persist.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lisp/org-persist.el b/lisp/org-persist.el index c4c185dc1c..0e8fd50509 100644 --- a/lisp/org-persist.el +++ b/lisp/org-persist.el @@ -328,7 +328,8 @@ Return PLIST." (when existing (org-persist-collection-let collection (dolist (cont (cons container container)) - (org-persist-gc:generic cont collection) + (unless (listp (car container)) +(org-persist-gc:generic cont collection)) (remhash (cons cont associated) org-persist--index-hash) (when path (remhash (cons cont (list :file path)) org-persist--index-hash)) (when inode (remhash (cons cont (list :inode inode)) org-persist--index-hash))
[elpa] externals/org aca62116da 12/31: org-persist-write: Update buffer hash on save
branch: externals/org commit aca62116da79d6f0cbc4061238f2c781e03a4b75 Author: Ihor Radchenko Commit: Ihor Radchenko org-persist-write: Update buffer hash on save --- lisp/org-persist.el | 5 + 1 file changed, 5 insertions(+) diff --git a/lisp/org-persist.el b/lisp/org-persist.el index aecfa57a73..664111a7ab 100644 --- a/lisp/org-persist.el +++ b/lisp/org-persist.el @@ -702,6 +702,11 @@ ASSOCIATED can be a plist, a buffer, or a string. A buffer is treated as (:buffer ASSOCIATED). A string is treated as (:file ASSOCIATED)." (setq associated (org-persist--normalize-associated associated)) + ;; Update hash + (when (and (plist-get associated :file) + (plist-get associated :hash) + (get-file-buffer (plist-get associated :file))) +(setq associated (org-persist--normalize-associated (get-file-buffer (plist-get associated :file) (let ((collection (org-persist--get-collection container associated))) (setf collection (plist-put collection :associated associated)) (unless (seq-find (lambda (v)
[elpa] externals/org eca678195b 23/31: org-persist-write: Return the written value on success
branch: externals/org commit eca678195b8691a81f65996203ca90bba4a4dcce Author: Ihor Radchenko Commit: Ihor Radchenko org-persist-write: Return the written value on success --- lisp/org-persist.el | 31 +-- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/lisp/org-persist.el b/lisp/org-persist.el index d4b74b52af..6ff5e7bd23 100644 --- a/lisp/org-persist.el +++ b/lisp/org-persist.el @@ -336,6 +336,18 @@ FORMAT and ARGS are passed to `message'." gc-func-symbol)) (funcall gc-func-symbol c ,collection))) +(defmacro org-persist--gc-expired-p (cnd collection) + "Check if expiry condition CND triggers for COLLECTION." + `(pcase ,cnd + (`nil t) + (`never nil) + ((pred numberp) + (when (plist-get ,collection :access-time) +(<= (float-time) (+ (plist-get ,collection :access-time) (* ,cnd 24 60 60) + ((pred functionp) + (funcall ,cnd ,collection)) + (_ (error "org-persist: Unsupported expiry type %S" ,cnd + Working with index (defmacro org-persist-collection-let (collection &rest body) @@ -792,7 +804,9 @@ The arguments have the same meaning as in `org-persist-read'." "Save CONTAINER according to ASSOCIATED. ASSOCIATED can be a plist, a buffer, or a string. A buffer is treated as (:buffer ASSOCIATED). -A string is treated as (:file ASSOCIATED)." +A string is treated as (:file ASSOCIATED). +The return value is nil when writing fails and the written value (as +returned by `org-persist-read') on success." (setq associated (org-persist--normalize-associated associated)) ;; Update hash (when (and (plist-get associated :file) @@ -808,7 +822,8 @@ A string is treated as (:file ASSOCIATED)." (let ((file (org-file-name-concat org-persist-directory (plist-get collection :persist-file))) (data (mapcar (lambda (c) (cons c (org-persist-write:generic c collection))) (plist-get collection :container - (org-persist--write-elisp-file file data)) + (org-persist--write-elisp-file file data) + (org-persist-read container associated)) (defun org-persist-write-all (&optional associated) "Save all the persistent data. @@ -853,18 +868,6 @@ Do nothing in an indirect buffer." (when (org-directory-empty-p (file-name-directory ,persist-file)) (delete-directory (file-name-directory ,persist-file) -(defmacro org-persist--gc-expired-p (cnd collection) - "Check if expiry condition CND triggers for COLLECTION." - `(pcase ,cnd - (`nil t) - (`never nil) - ((pred numberp) - (when (plist-get ,collection :access-time) -(<= (float-time) (+ (plist-get ,collection :access-time) (* ,cnd 24 60 60) - ((pred functionp) - (funcall ,cnd ,collection)) - (_ (error "org-persist: Unsupported expiry type %S" ,cnd - (defun org-persist-gc () "Remove expired or unregisted containers. Also, remove containers associated with non-existing files."
[elpa] externals/org 1bc8389871 21/31: org-persist-read: Check expiry
branch: externals/org commit 1bc8389871472d77e230f162d818e20453c0c58d Author: Ihor Radchenko Commit: Ihor Radchenko org-persist-read: Check expiry --- lisp/org-persist.el | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lisp/org-persist.el b/lisp/org-persist.el index 5c3858959e..bff1a094ee 100644 --- a/lisp/org-persist.el +++ b/lisp/org-persist.el @@ -743,6 +743,9 @@ When LOAD? is non-nil, load the data instead of reading." (data nil)) (when (and collection (file-exists-p persist-file) + (or (not (plist-get collection :expiry)) ; current session + (not (org-persist--gc-expired-p + (plist-get collection :expiry) collection))) (or (not hash-must-match) (and (plist-get associated :hash) (equal (plist-get associated :hash)
[elpa] externals/org f3bd1dcb77 20/31: org-persist: Fix compiler warnings
branch: externals/org commit f3bd1dcb77b664f6bffc64188baa29d69ccdbb20 Author: Ihor Radchenko Commit: Ihor Radchenko org-persist: Fix compiler warnings --- lisp/org-persist.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lisp/org-persist.el b/lisp/org-persist.el index 98d2f11afb..5c3858959e 100644 --- a/lisp/org-persist.el +++ b/lisp/org-persist.el @@ -449,7 +449,7 @@ MISC, if non-nil will be appended to the collection." (defun org-persist--normalize-associated (associated) "Normalize ASSOCIATED representation into (:type value)." (pcase associated -((or (pred stringp) `(:file ,associated2)) +((or (pred stringp) `(:file ,_)) (unless (stringp associated) (setq associated (cadr associated))) (let* ((rtn `(:file ,associated)) @@ -458,7 +458,7 @@ MISC, if non-nil will be appended to the collection." (file-attributes associated) (when inode (plist-put rtn :inode inode)) rtn)) -((or (pred bufferp) `(:buffer ,associated2)) +((or (pred bufferp) `(:buffer ,_)) (unless (bufferp associated) (setq associated (cadr associated))) (let ((cached (gethash associated org-persist--associated-buffer-cache))
[elpa] externals/org 4ec57a9453 16/31: org-persist: Update commentary
branch: externals/org commit 4ec57a94534c15e616c581d5d6fa138f4061e0b4 Author: Ihor Radchenko Commit: Ihor Radchenko org-persist: Update commentary --- lisp/org-persist.el | 54 + 1 file changed, 50 insertions(+), 4 deletions(-) diff --git a/lisp/org-persist.el b/lisp/org-persist.el index fad67e84c0..cd1a499e16 100644 --- a/lisp/org-persist.el +++ b/lisp/org-persist.el @@ -1,4 +1,4 @@ -;;; org-persist.el --- Persist data across Emacs sessions -*- lexical-binding: t; -*- +;;; org-persist.el --- Persist cached data across Emacs sessions -*- lexical-binding: t; -*- ;; Copyright (C) 2021-2022 Free Software Foundation, Inc. @@ -22,8 +22,46 @@ ;;; Commentary: ;; -;; This file implements persistant data storage across Emacs sessions. -;; Both global and buffer-local data can be stored. +;; This file implements persistant cache storage across Emacs sessions. +;; Both global and buffer-local data can be stored. This +;; implementation is not meant to be used to store important data - +;; all the caches should be safe to remove at any time. +;; +;; Example usage: +;; +;; 1. Temporarily cache Elisp symbol value to disk. Remove upon +;;closing Emacs: +;;(org-persist-write 'variable-symbol) +;;(org-persist-read 'variable-symbol) ;; read the data later +;; 2. Temporarily cache a remote URL file to disk. Remove upon +;;closing Emacs: +;;(org-persist-write '("url") "https://static.fsf.org/common/img/logo-new.png";) +;;(org-persist-read '("url") "https://static.fsf.org/common/img/logo-new.png";) +;;`org-persist-read' will return the cached file location or nil if cached file +;;has been removed. +;; 3. Temporarily cache a file, including TRAMP path to disk: +;;(org-persist-write '("file") "/path/to/file") +;; 4. Cache value of a Elisp variable to disk. The value will be +;;saved and restored automatically (except buffer-local +;;variables). +;;;; Until `org-persist-default-expiry' +;;(org-persist-register 'variable-symbol) +;;;; Specify expiry explicitly +;;(org-persist-register 'variable-symbol :expiry 'never) +;;;; Save buffer-local variable (buffer-local will not be +;;;; autoloaded!) +;;(org-persist-register 'org-element--cache (current-buffer)) +;;;; Save buffer-local variable preserving circular links: +;;(org-persist-register 'org-element--headline-cache (current-buffer) +;; :inherit 'org-element--cache) +;; 5. Load variable by side effects assigning variable symbol: +;;(org-persist-load 'variable-symbol (current-buffer)) +;; 6. Version variable value: +;;(org-persist-register '(("elisp" variable-symbol) (version "2.0"))) +;; 7. Cancel variable persistence: +;;(org-persist-unregister 'variable-symbol 'all) ; in all buffers +;;(org-persist-unregister 'variable-symbol) ;; global variable +;;(org-persist-unregister 'variable-symbol (current-buffer)) ;; buffer-local ;; ;; Most common data type is variable data. However, other data types ;; can also be stored. @@ -73,7 +111,7 @@ ;;file; ;; - `:persist-file': data file name; ;; - `:associated' : list of associated objects; -;; - `:last-access' : last date when the container has been read; +;; - `:last-access' : last date when the container has been accessed; ;; - `:expiry' : list of expiry conditions. ;; - all other keywords are ignored ;; @@ -95,6 +133,14 @@ ;; a number - data will expire after the number days from last access; ;; a function - data will expire if the function, called with a single ;; argument - collection, returns non-nil. +;; +;; +;; Data collections associated with files will automatically expire +;; when the file is removed. If the associated file is remote, the +;; expiry is controlled by `org-persist-remote-files' instead. +;; +;; Data loading/writing can be more accurately controlled using +;; `org-persist-before-write-hook', `org-persist-before-read-hook', and `org-persist-after-read-hook'. ;;; Code:
[elpa] externals/org updated (22e6ed6b89 -> ac5742f296)
elpasync pushed a change to branch externals/org. from 22e6ed6b89 agenda: Add header to agenda clock report table new edd7f2962f org-persist: Reimplement using more generic approach new 2a4e5a8e58 org-persist--normalize-associated: Use cache to calculate buffer hash new 7c2d93560c org-persist-default-expiry: Introduce and change default new 1c79af13df org-persist-gc: Fix when expiry is days and data is freshly created new 38a681fdae org-element-cache-reset: Do not persist caches for non-file buffers new dafa32da49 org-persist: Update index version new 703df9310a org-persist: Cleanup on removal and version mismatch new 1084566322 Fix org-persist-unregister new 8821ff5811 org-persist-read: Do not try to read non-existing containers new 1869a37a2c Fix org-persist--remove-from-index new 203420504e org-persist-load:elisp: fix loading new aca62116da org-persist-write: Update buffer hash on save new 9b650938e7 org-persist: Provide human readable access time and make sure it exist new f963d617a4 Fix checkdoc warnings new d5fc159bf7 Fix compiler warnings new 4ec57a9453 org-persist: Update commentary new dc52c0fe99 Fix native-comp warnings new fca80139ee org-persist: Fix compatibility with Emacs 27 new ec787fb218 org-persist: Implement "file" and "url" containers linked to other file new f3bd1dcb77 org-persist: Fix compiler warnings new 1bc8389871 org-persist-read: Check expiry new 0526acd16f org-persist-register: New optional keyword to force immidiate write new eca678195b org-persist-write: Return the written value on success new 0e18c617cf org-persist-write:index: Return index path on write new 6a5874bb26 org-persist-write: Overwrite existing copy if write is requested new caccec2c54 org-persist: Use symbols as container names new 6b175fb227 org-persist-register: Make return value meaningful with :write-immidiately new f0e0716f54 org-element: Use new cache container format new 19a383d9f4 org-persist-write-all: Speed up writing new 7014675226 org-mode: Fix cache loading order new ac5742f296 Merge branch 'feature/org-persist-new-tidy' Summary of changes: lisp/org-element.el | 73 ++-- lisp/org-persist.el | 1072 +++ lisp/org.el |5 +- 3 files changed, 862 insertions(+), 288 deletions(-)
[elpa] externals/org 8821ff5811 09/31: org-persist-read: Do not try to read non-existing containers
branch: externals/org commit 8821ff5811e3d8f95c3b7f01920d254bce611eb9 Author: Ihor Radchenko Commit: Ihor Radchenko org-persist-read: Do not try to read non-existing containers --- lisp/org-persist.el | 8 ++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lisp/org-persist.el b/lisp/org-persist.el index 6fbf67fe67..c4c185dc1c 100644 --- a/lisp/org-persist.el +++ b/lisp/org-persist.el @@ -649,8 +649,12 @@ A buffer is treated as (:buffer ASSOCIATED). A string is treated as (:file ASSOCIATED)." (setq associated (org-persist--normalize-associated associated)) (setq container (org-persist--normalize-container container)) - (let* ((collection (org-persist--get-collection container associated)) - (persist-file (org-file-name-concat org-persist-directory (plist-get collection :persist-file))) + (let* ((collection (org-persist--find-index `(:container ,container :associated ,associated))) + (persist-file + (when collection +(org-file-name-concat + org-persist-directory + (plist-get collection :persist-file (data nil)) (when (and collection (file-exists-p persist-file)
[elpa] externals/org 1c79af13df 04/31: org-persist-gc: Fix when expiry is days and data is freshly created
branch: externals/org commit 1c79af13df9d3a611e4b773d395633e9095d367b Author: Ihor Radchenko Commit: Ihor Radchenko org-persist-gc: Fix when expiry is days and data is freshly created --- lisp/org-persist.el | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lisp/org-persist.el b/lisp/org-persist.el index 7ac6940b0b..243e2b22c5 100644 --- a/lisp/org-persist.el +++ b/lisp/org-persist.el @@ -756,10 +756,11 @@ Do nothing in an indirect buffer." (`nil t) (`never nil) ((pred numberp) - (<= (float-time) (+ (plist-get ,collection :access-time) (* ,cnd 24 60 60 + (when (plist-get ,collection :access-time) +(<= (float-time) (+ (plist-get ,collection :access-time) (* ,cnd 24 60 60) ((pred functionp) (funcall ,cnd ,collection)) - (_ (error "org-persist: Unsupported expiry type %S" cnd + (_ (error "org-persist: Unsupported expiry type %S" ,cnd (defun org-persist-gc () "Remove expired or unregisted containers.
[elpa] externals/org 6a5874bb26 25/31: org-persist-write: Overwrite existing copy if write is requested
branch: externals/org commit 6a5874bb26c028640ce689f93b64cea9874ff637 Author: Ihor Radchenko Commit: Ihor Radchenko org-persist-write: Overwrite existing copy if write is requested --- lisp/org-persist.el | 6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/lisp/org-persist.el b/lisp/org-persist.el index 3495485844..099b4aff8a 100644 --- a/lisp/org-persist.el +++ b/lisp/org-persist.el @@ -634,8 +634,7 @@ COLLECTION is the plist holding data collectin." (format "%s-%s.%s" persist-file (md5 path) ext (unless (file-exists-p (file-name-directory file-copy)) (make-directory (file-name-directory file-copy) t)) -(unless (file-exists-p file-copy) - (copy-file path file-copy 'overwrite)) +(copy-file path file-copy 'overwrite) (format "%s-%s.%s" persist-file (md5 path) ext) (defun org-persist-write:url (c collection) @@ -650,8 +649,7 @@ COLLECTION is the plist holding data collectin." (format "%s-%s.%s" persist-file (md5 path) ext (unless (file-exists-p (file-name-directory file-copy)) (make-directory (file-name-directory file-copy) t)) -(unless (file-exists-p file-copy) - (url-copy-file path file-copy 'overwrite)) +(url-copy-file path file-copy 'overwrite) (format "%s-%s.%s" persist-file (md5 path) ext) (defun org-persist-write:index (container _)
[elpa] externals/org 7014675226 30/31: org-mode: Fix cache loading order
branch: externals/org commit 7014675226eae17f3c7a6fa4c44a23daa7ae29ac Author: Ihor Radchenko Commit: Ihor Radchenko org-mode: Fix cache loading order --- lisp/org.el | 7 +-- 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/lisp/org.el b/lisp/org.el index 4e27c69261..b3c5f31045 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -4882,7 +4882,7 @@ The following commands are available: (org-element-cache-reset) (when (and org-element-cache-persistent org-element-use-cache) -(org-persist-read 'org-element--cache (current-buffer))) +(org-persist-load 'org-element--cache (current-buffer) t)) ;; Initialize macros templates. (org-macro-initialize-templates) ;; Initialize radio targets. @@ -4894,11 +4894,6 @@ The following commands are available: (org-setup-filling) ;; Comments. (org-setup-comments-handling) - ;; Initialize cache. - (org-element-cache-reset) - (when (and org-element-cache-persistent - org-element-use-cache) -(org-persist-load 'org-element--cache (current-buffer) t)) ;; Beginning/end of defun (setq-local beginning-of-defun-function 'org-backward-element) (setq-local end-of-defun-function
[elpa] externals/org f963d617a4 14/31: Fix checkdoc warnings
branch: externals/org commit f963d617a4d0433ca060df18a82bbe1ddc89cc43 Author: Ihor Radchenko Commit: Ihor Radchenko Fix checkdoc warnings --- lisp/org-persist.el | 50 +++--- 1 file changed, 27 insertions(+), 23 deletions(-) diff --git a/lisp/org-persist.el b/lisp/org-persist.el index 524c438e7d..8c97ac3762 100644 --- a/lisp/org-persist.el +++ b/lisp/org-persist.el @@ -90,7 +90,7 @@ ;; The data collections can expire, in which case they will be removed ;; from the persistent storage at the end of Emacs session. The ;; expiry condition can be set when saving/registering data -;; containers. The expirty condition can be `never' - data will never +;; containers. The expirty condition can be `never' - data will never ;; expire; `nil' - data will expire at the end of current Emacs session; ;; a number - data will expire after the number days from last access; ;; a function - data will expire if the function, called with a single @@ -130,9 +130,9 @@ "Whether to keep persistent data for remote files. When this variable is nil, never save persitent data associated with -remote files. When `t', always keep the data. When +remote files. When t, always keep the data. When `check-existence', contact remote server containing the file and only -keep the data when the file exists on the server. When a number, keep +keep the data when the file exists on the server. When a number, keep up to that number persistent values for remote files. Note that the last option `check-existence' may cause Emacs to show @@ -146,7 +146,7 @@ password prompts to log in." (defcustom org-persist-default-expiry 30 "Default expiry condition for persistent data. -When this variable is `nil', all the data vanishes at the end of Emacs +When this variable is nil, all the data vanishes at the end of Emacs session. When `never', the data never vanishes. When a number, the data is deleted that number days after last access. When a function, it should be a function returning non-nil when the data is expired. The @@ -341,7 +341,8 @@ Return PLIST." "Return or create collection used to store CONTAINER for ASSOCIATED. When ASSOCIATED is nil, it is a global CONTAINER. ASSOCIATED can also be a (:buffer buffer) or buffer, (:file file-path) -or file-path, (:inode inode), (:hash hash), or or (:key key)." +or file-path, (:inode inode), (:hash hash), or or (:key key). +MISC, if non-nil will be appended to the collection." (unless (and (listp container) (listp (car container))) (setq container (list container))) (setq associated (org-persist--normalize-associated associated)) @@ -429,25 +430,25 @@ COLLECTION is the plist holding data collectin." (funcall read-func-symbol c ,reference-data ,collection))) (defun org-persist-read:elisp (_ lisp-value _) - "Read elisp container and return the stored data." + "Read elisp container and return LISP-VALUE." lisp-value) (defun org-persist-read:version (container _ _) - "Read version container." + "Read version CONTAINER." (cadr container)) (defun org-persist-read:file (_ path _) - "Read file container." + "Read file container from PATH." (when (and path (file-exists-p (concat org-persist-directory path))) (concat org-persist-directory path))) (defun org-persist-read:url (_ path _) - "Read file container." + "Read file container from PATH." (when (and path (file-exists-p (concat org-persist-directory path))) (concat org-persist-directory path))) (defun org-persist-read:index (cont index-file _) - "Read index container." + "Read index container CONT from INDEX-FILE." (when (file-exists-p index-file) (let ((index (org-persist--read-elisp-file index-file))) (when index @@ -477,7 +478,7 @@ COLLECTION is the plist holding data collectin." (funcall load-func-symbol container ,reference-data ,collection))) (defun org-persist-load:elisp (container lisp-value collection) - "Load elisp variable container and assign the data to variable symbol." + "Assign elisp CONTAINER in COLLECTION LISP-VALUE." (let ((lisp-symbol (cadr container)) (buffer (when (plist-get (plist-get collection :associated) :file) (get-file-buffer (plist-get (plist-get collection :associated) :file) @@ -491,7 +492,7 @@ COLLECTION is the plist holding data collectin." (defalias 'org-persist-load:file #'org-persist-read:file) (defun org-persist-load:index (container index-file _) - "Load `org-persist--index'." + "Load `org-persist--index' from INDEX-FILE according to CONTAINER." (unless org-persist--index (setq org-persist--index (org-persist-read:index container index-file nil)) (setq org-persist--index-hash nil) @@ -526,7 +527,7 @@ COLLECTION is the plist holding data collectin." (funcall write-func-symbol c ,collection))) (defun org-persist-write:elisp (container collection) - "Write elisp CONTAINER." + "Write elisp CON
[elpa] externals/org dafa32da49 06/31: org-persist: Update index version
branch: externals/org commit dafa32da49bc6ff79c2a5ea9141349b2d04adca5 Author: Ihor Radchenko Commit: Ihor Radchenko org-persist: Update index version --- lisp/org-persist.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/org-persist.el b/lisp/org-persist.el index 243e2b22c5..85908db788 100644 --- a/lisp/org-persist.el +++ b/lisp/org-persist.el @@ -102,7 +102,7 @@ (require 'org-id) (require 'xdg nil t) -(defconst org-persist--storage-version "2.0" +(defconst org-persist--storage-version "2.1" "Persistent storage layout version.") (defgroup org-persist nil
[elpa] externals/org fca80139ee 18/31: org-persist: Fix compatibility with Emacs 27
branch: externals/org commit fca80139eebf704d523de559ee9bfa6498565483 Author: Ihor Radchenko Commit: Ihor Radchenko org-persist: Fix compatibility with Emacs 27 * lisp/org-persist.el (org-persist--normalize-associated): Do not expect that we can bind new vars in pacse forms. (org-persist-read:elisp): (org-persist-read:version): (org-persist-read:file): (org-persist-read:url): Avoid multiple `_' placeholders. --- lisp/org-persist.el | 14 -- 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/lisp/org-persist.el b/lisp/org-persist.el index 4552dd4f2e..f80a8e2c18 100644 --- a/lisp/org-persist.el +++ b/lisp/org-persist.el @@ -443,7 +443,8 @@ MISC, if non-nil will be appended to the collection." "Normalize ASSOCIATED representation into (:type value)." (pcase associated ((or (pred stringp) `(:file ,associated2)) - (when associated2 (setq associated associated2)) + (unless (stringp associated) + (setq associated (cadr associated))) (let* ((rtn `(:file ,associated)) (inode (and (fboundp 'file-attribute-inode-number) (file-attribute-inode-number @@ -451,7 +452,8 @@ MISC, if non-nil will be appended to the collection." (when inode (plist-put rtn :inode inode)) rtn)) ((or (pred bufferp) `(:buffer ,associated2)) - (when associated2 (setq associated associated2)) + (unless (bufferp associated) + (setq associated (cadr associated))) (let ((cached (gethash associated org-persist--associated-buffer-cache)) file inode hash) (if (and cached (eq (buffer-modified-tick associated) @@ -493,20 +495,20 @@ COLLECTION is the plist holding data collectin." read-func-symbol)) (funcall read-func-symbol c ,reference-data ,collection))) -(defun org-persist-read:elisp (_ lisp-value _) +(defun org-persist-read:elisp (_ lisp-value __) "Read elisp container and return LISP-VALUE." lisp-value) -(defun org-persist-read:version (container _ _) +(defun org-persist-read:version (container _ __) "Read version CONTAINER." (cadr container)) -(defun org-persist-read:file (_ path _) +(defun org-persist-read:file (_ path __) "Read file container from PATH." (when (and path (file-exists-p (concat org-persist-directory path))) (concat org-persist-directory path))) -(defun org-persist-read:url (_ path _) +(defun org-persist-read:url (_ path __) "Read file container from PATH." (when (and path (file-exists-p (concat org-persist-directory path))) (concat org-persist-directory path)))
[elpa] externals/org 203420504e 11/31: org-persist-load:elisp: fix loading
branch: externals/org commit 203420504edcaa42703d8f1e783f656585db2a0b Author: Ihor Radchenko Commit: Ihor Radchenko org-persist-load:elisp: fix loading --- lisp/org-persist.el | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lisp/org-persist.el b/lisp/org-persist.el index 0e8fd50509..aecfa57a73 100644 --- a/lisp/org-persist.el +++ b/lisp/org-persist.el @@ -474,11 +474,11 @@ COLLECTION is the plist holding data collectin." load-func-symbol)) (funcall load-func-symbol container ,reference-data ,collection))) -(defun org-persist-load:elisp (container lisp-value associated) +(defun org-persist-load:elisp (container lisp-value collection) "Load elisp variable container and assign the data to variable symbol." (let ((lisp-symbol (cadr container)) -(buffer (when (plist-get associated :file) - (get-file-buffer (plist-get associated :file) +(buffer (when (plist-get (plist-get collection :associated) :file) + (get-file-buffer (plist-get (plist-get collection :associated) :file) (if buffer (with-current-buffer buffer (make-variable-buffer-local lisp-symbol)
[elpa] externals/org 6b175fb227 27/31: org-persist-register: Make return value meaningful with :write-immidiately
branch: externals/org commit 6b175fb2277b17167e2fedff6326b09fac513c7f Author: Ihor Radchenko Commit: Ihor Radchenko org-persist-register: Make return value meaningful with :write-immidiately * lisp/org-persist.el (org-persist-register): Return the return value of `org-persist-write' when `:write-immediately' is non-nil. --- lisp/org-persist.el | 8 +--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lisp/org-persist.el b/lisp/org-persist.el index 24c4ab1e38..2c6cec4e42 100644 --- a/lisp/org-persist.el +++ b/lisp/org-persist.el @@ -697,7 +697,9 @@ last access, or a function accepting a single argument - collection. EXPIRY key has no effect when INHERIT is non-nil. Optional key WRITE-IMMEDIATELY controls whether to save the container data immediately. -MISC will be appended to CONTAINER." +MISC will be appended to CONTAINER. +When WRITE-IMMEDIATELY is non-nil, the return value will be the same +with `org-persist-write'." (unless org-persist--index (org-persist--load-index)) (setq container (org-persist--normalize-container container)) (when inherit @@ -713,12 +715,12 @@ MISC will be appended to CONTAINER." (let ((collection (org-persist--get-collection container associated misc))) (when (and expiry (not inherit)) (when expiry (plist-put collection :expiry expiry - (when write-immediately (org-persist-write container associated)) (when (or (bufferp associated) (bufferp (plist-get associated :buffer))) (with-current-buffer (if (bufferp associated) associated (plist-get associated :buffer)) - (add-hook 'kill-buffer-hook #'org-persist-write-all-buffer nil 'local + (add-hook 'kill-buffer-hook #'org-persist-write-all-buffer nil 'local))) + (when write-immediately (org-persist-write container associated))) (defun org-persist-unregister (container &optional associated) "Unregister CONTAINER in ASSOCIATED to be persistent.
[elpa] externals/org 19a383d9f4 29/31: org-persist-write-all: Speed up writing
branch: externals/org commit 19a383d9f4bf3bd893542c757e2fed6ec1ff4cac Author: Ihor Radchenko Commit: Ihor Radchenko org-persist-write-all: Speed up writing * lisp/org-persist.el (org-persist-write): New optional argument bypassing extra `org-persist-read' invocation. (org-persist-write-all): Call faster version of `org-persist-write'. --- lisp/org-persist.el | 12 +++- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/lisp/org-persist.el b/lisp/org-persist.el index 2c6cec4e42..fcc4d82d55 100644 --- a/lisp/org-persist.el +++ b/lisp/org-persist.el @@ -800,13 +800,15 @@ The arguments have the same meaning as in `org-persist-read'." "Call `org-persist-load-all' in current buffer." (org-persist-load-all (current-buffer))) -(defun org-persist-write (container &optional associated) +(defun org-persist-write (container &optional associated ignore-return) "Save CONTAINER according to ASSOCIATED. ASSOCIATED can be a plist, a buffer, or a string. A buffer is treated as (:buffer ASSOCIATED). A string is treated as (:file ASSOCIATED). The return value is nil when writing fails and the written value (as -returned by `org-persist-read') on success." +returned by `org-persist-read') on success. +When IGNORE-RETURN is non-nil, just return t on success without calling +`org-persist-read'." (setq associated (org-persist--normalize-associated associated)) ;; Update hash (when (and (plist-get associated :file) @@ -823,7 +825,7 @@ returned by `org-persist-read') on success." (data (mapcar (lambda (c) (cons c (org-persist-write:generic c collection))) (plist-get collection :container (org-persist--write-elisp-file file data) - (org-persist-read container associated)) + (or ignore-return (org-persist-read container associated))) (defun org-persist-write-all (&optional associated) "Save all the persistent data. @@ -835,10 +837,10 @@ When ASSOCIATED is non-nil, only save the matching data." (if associated (when collection (cl-pushnew (plist-get collection :container) all-containers :test #'equal)) -(org-persist-write (plist-get collection :container) (plist-get collection :associated +(org-persist-write (plist-get collection :container) (plist-get collection :associated) t))) (dolist (container all-containers) (when (org-persist--find-index `(:container ,container :associated ,associated)) -(org-persist-write container associated) +(org-persist-write container associated t) (defun org-persist-write-all-buffer () "Call `org-persist-write-all' in current buffer.
[elpa] externals/org 0526acd16f 22/31: org-persist-register: New optional keyword to force immidiate write
branch: externals/org commit 0526acd16f7fc529b902ea04daffc1f2256aa4ee Author: Ihor Radchenko Commit: Ihor Radchenko org-persist-register: New optional keyword to force immidiate write * lisp/org-persist.el: Update commentary. (org-persist-register): Add new keyword `write-immediately' to write the newrly registerd container to disk immediately. --- lisp/org-persist.el | 15 ++- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/lisp/org-persist.el b/lisp/org-persist.el index bff1a094ee..d4b74b52af 100644 --- a/lisp/org-persist.el +++ b/lisp/org-persist.el @@ -42,11 +42,9 @@ ;; 3. Temporarily cache a file, including TRAMP path to disk: ;;(org-persist-write '("file") "/path/to/file") ;; 4. Cache file or URL while some other file exists. -;;(org-persist-register '("url" "https://static.fsf.org/common/img/logo-new.png";) '(:file "/path to the other file") :expiry 'never) -;;(org-persist-write '("url" "https://static.fsf.org/common/img/logo-new.png";) '(:file "/path to the other file")) +;;(org-persist-register '("url" "https://static.fsf.org/common/img/logo-new.png";) '(:file "/path to the other file") :expiry 'never :write-immediately t) ;;or, if the other file is current buffer file -;;(org-persist-register '("url" "https://static.fsf.org/common/img/logo-new.png";) (current-buffer) :expiry 'never) -;;(org-persist-write '("url" "https://static.fsf.org/common/img/logo-new.png";) (current-buffer)) +;;(org-persist-register '("url" "https://static.fsf.org/common/img/logo-new.png";) (current-buffer) :expiry 'never :write-immediately t) ;; 5. Cache value of a Elisp variable to disk. The value will be ;;saved and restored automatically (except buffer-local ;;variables). @@ -674,7 +672,11 @@ COLLECTION is the plist holding data collectin." Public API -(cl-defun org-persist-register (container &optional associated &rest misc &key inherit &key (expiry org-persist-default-expiry) &allow-other-keys) +(cl-defun org-persist-register (container &optional associated &rest misc + &key inherit + &key (expiry org-persist-default-expiry) + &key (write-immediately nil) + &allow-other-keys) "Register CONTAINER in ASSOCIATED to be persistent across Emacs sessions. Optional key INHERIT makes CONTAINER dependent on another container. Such dependency means that data shared between variables will be @@ -683,6 +685,8 @@ Optional key EXPIRY will set the expiry condition of the container. It can be `never', nil - until end of session, a number of days since last access, or a function accepting a single argument - collection. EXPIRY key has no effect when INHERIT is non-nil. +Optional key WRITE-IMMEDIATELY controls whether to save the container +data immediately. MISC will be appended to CONTAINER." (unless org-persist--index (org-persist--load-index)) (setq container (org-persist--normalize-container container)) @@ -699,6 +703,7 @@ MISC will be appended to CONTAINER." (let ((collection (org-persist--get-collection container associated misc))) (when (and expiry (not inherit)) (when expiry (plist-put collection :expiry expiry + (when write-immediately (org-persist-write container associated)) (when (or (bufferp associated) (bufferp (plist-get associated :buffer))) (with-current-buffer (if (bufferp associated) associated
[elpa] externals/org 0e18c617cf 24/31: org-persist-write:index: Return index path on write
branch: externals/org commit 0e18c617cf9ef148ea2e46ea9fad95a1380b6e9b Author: Ihor Radchenko Commit: Ihor Radchenko org-persist-write:index: Return index path on write --- lisp/org-persist.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/org-persist.el b/lisp/org-persist.el index 6ff5e7bd23..3495485844 100644 --- a/lisp/org-persist.el +++ b/lisp/org-persist.el @@ -675,7 +675,7 @@ COLLECTION is the plist holding data collectin." (org-file-name-concat org-persist-directory org-persist-index-file) org-persist--index t t) -t)) +(org-file-name-concat org-persist-directory org-persist-index-file))) (defun org-persist--save-index () "Save `org-persist--index."
[elpa] externals/org caccec2c54 26/31: org-persist: Use symbols as container names
branch: externals/org commit caccec2c54e9f79885d5c557343d0b6f297ed276 Author: Ihor Radchenko Commit: Ihor Radchenko org-persist: Use symbols as container names * lisp/org-persist.el: Update commentary. (org-persist--storage-version): Bump index version. (org-persist--normalize-container): (org-persist-read:index): (org-persist--load-index): (org-persist--save-index): Use symbol for container names. --- lisp/org-persist.el | 44 ++-- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/lisp/org-persist.el b/lisp/org-persist.el index 099b4aff8a..24c4ab1e38 100644 --- a/lisp/org-persist.el +++ b/lisp/org-persist.el @@ -35,16 +35,16 @@ ;;(org-persist-read 'variable-symbol) ;; read the data later ;; 2. Temporarily cache a remote URL file to disk. Remove upon ;;closing Emacs: -;;(org-persist-write '("url") "https://static.fsf.org/common/img/logo-new.png";) -;;(org-persist-read '("url") "https://static.fsf.org/common/img/logo-new.png";) +;;(org-persist-write 'url "https://static.fsf.org/common/img/logo-new.png";) +;;(org-persist-read 'url "https://static.fsf.org/common/img/logo-new.png";) ;;`org-persist-read' will return the cached file location or nil if cached file ;;has been removed. ;; 3. Temporarily cache a file, including TRAMP path to disk: -;;(org-persist-write '("file") "/path/to/file") +;;(org-persist-write 'file "/path/to/file") ;; 4. Cache file or URL while some other file exists. -;;(org-persist-register '("url" "https://static.fsf.org/common/img/logo-new.png";) '(:file "/path to the other file") :expiry 'never :write-immediately t) +;;(org-persist-register '(url "https://static.fsf.org/common/img/logo-new.png";) '(:file "/path to the other file") :expiry 'never :write-immediately t) ;;or, if the other file is current buffer file -;;(org-persist-register '("url" "https://static.fsf.org/common/img/logo-new.png";) (current-buffer) :expiry 'never :write-immediately t) +;;(org-persist-register '(url "https://static.fsf.org/common/img/logo-new.png";) (current-buffer) :expiry 'never :write-immediately t) ;; 5. Cache value of a Elisp variable to disk. The value will be ;;saved and restored automatically (except buffer-local ;;variables). @@ -61,7 +61,7 @@ ;; 6. Load variable by side effects assigning variable symbol: ;;(org-persist-load 'variable-symbol (current-buffer)) ;; 7. Version variable value: -;;(org-persist-register '(("elisp" variable-symbol) (version "2.0"))) +;;(org-persist-register '((elisp variable-symbol) (version "2.0"))) ;; 8. Cancel variable persistence: ;;(org-persist-unregister 'variable-symbol 'all) ; in all buffers ;;(org-persist-unregister 'variable-symbol) ;; global variable @@ -86,9 +86,9 @@ ;; 1. Container :: a type of data to be stored ;;Containers can store elisp variables, files, and version ;;numbers. Each container can be customized with container -;;options. For example, "elisp" container is customized with -;;variable symbol. ("elisp" variable) is a container storing -;;Lisp variable value. Similarly, ("version" "2.0") container +;;options. For example, `elisp' container is customized with +;;variable symbol. (elisp variable) is a container storing +;;Lisp variable value. Similarly, (version "2.0") container ;;will store version number. ;; 2. Associated :: an object the container is associated with. The ;;object can be a buffer, file, inode number, file contents hash, @@ -120,15 +120,15 @@ ;; - all other keywords are ignored ;; ;; The available types of data containers are: -;; 1. ("elisp" variable-symbol) or just variable-symbol :: Storing +;; 1. (file variable-symbol) or just variable-symbol :: Storing ;;elisp variable data. -;; 2. ("file") :: Store a copy of the associated file preserving the +;; 2. (file) :: Store a copy of the associated file preserving the ;;extension. -;;("file" "/path/to/a/file") :: Store a copy of the file in path. -;; 3. ("version" "version number") :: Version the data collection. +;;(file "/path/to/a/file") :: Store a copy of the file in path. +;; 3. (version "version number") :: Version the data collection. ;; If the stored collection has different version than "version ;; number", disregard it. -;; 4. ("url") :: Store a downloaded copy of URL object. +;; 4. (url) :: Store a downloaded copy of URL object. ;; ;; The data collections can expire, in which case they will be removed ;; from the persistent storage at the end of Emacs session. The @@ -158,7 +158,7 @@ (declare-function org-at-heading-p "org" (&optional invisible-not-ok)) -(defconst org-persist--storage-version "2.3" +(defconst org-persist--storage-version "2.4" "Persistent storage layout version.") (defgroup org-persist nil @@ -445,11 +445,11 @@ MISC, if non-nil will be appended to the c
[elpa] externals/org f0e0716f54 28/31: org-element: Use new cache container format
branch: externals/org commit f0e0716f543ef3d7a8b197c0840ab459e23c844f Author: Ihor Radchenko Commit: Ihor Radchenko org-element: Use new cache container format --- lisp/org-element.el | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lisp/org-element.el b/lisp/org-element.el index 307b93b3fc..77a9fc6e3e 100644 --- a/lisp/org-element.el +++ b/lisp/org-element.el @@ -7056,7 +7056,7 @@ The element is: %S\n The real element is: %S\n Cache around :begin:\n%S\n%S\n%S" (defun org-element--cache-persist-before-write (container &optional associated) "Sync cache before saving." - (when (equal container '("elisp" org-element--cache)) + (when (equal container '(elisp org-element--cache)) (if (and org-element-use-cache (plist-get associated :file) (get-file-buffer (plist-get associated :file)) @@ -7079,7 +7079,7 @@ The element is: %S\n The real element is: %S\n Cache around :begin:\n%S\n%S\n%S" (defun org-element--cache-persist-before-read (container &optional associated) "Avoid reading cache before Org mode is loaded." - (when (equal container '("elisp" org-element--cache)) + (when (equal container '(elisp org-element--cache)) (if (not (and (plist-get associated :file) (get-file-buffer (plist-get associated :file 'forbid @@ -7097,9 +7097,9 @@ The element is: %S\n The real element is: %S\n Cache around :begin:\n%S\n%S\n%S" (get-file-buffer (plist-get associated :file))) (with-current-buffer (get-file-buffer (plist-get associated :file)) (when (and org-element-use-cache org-element-cache-persistent) -(when (and (equal container '("elisp" org-element--cache)) org-element--cache) +(when (and (equal container '(elisp org-element--cache)) org-element--cache) (setq-local org-element--cache-size (avl-tree-size org-element--cache))) -(when (and (equal container '("elisp" org-element--headline-cache)) org-element--headline-cache) +(when (and (equal container '(elisp org-element--headline-cache)) org-element--headline-cache) (setq-local org-element--headline-cache-size (avl-tree-size org-element--headline-cache))) (add-hook 'org-persist-before-write-hook #'org-element--cache-persist-before-write)
[elpa] externals/org 2a4e5a8e58 02/31: org-persist--normalize-associated: Use cache to calculate buffer hash
branch: externals/org commit 2a4e5a8e58f381497b5b53e96691ac2eaf98bdcd Author: Ihor Radchenko Commit: Ihor Radchenko org-persist--normalize-associated: Use cache to calculate buffer hash --- lisp/org-persist.el | 31 +++ 1 file changed, 23 insertions(+), 8 deletions(-) diff --git a/lisp/org-persist.el b/lisp/org-persist.el index 9fee5f7936..413c7790d8 100644 --- a/lisp/org-persist.el +++ b/lisp/org-persist.el @@ -355,6 +355,9 @@ or file-path, (:inode inode), (:hash hash), or or (:key key)." container) (_ (error "org-persist: Unknown container type: %S" container) +(defvar org-persist--associated-buffer-cache (make-hash-table :weakness 'key) + "Buffer hash cache.") + (defun org-persist--normalize-associated (associated) "Normalize ASSOCIATED representation into (:type value)." (pcase associated @@ -368,14 +371,26 @@ or file-path, (:inode inode), (:hash hash), or or (:key key)." rtn)) ((or (pred bufferp) `(:buffer ,associated2)) (when associated2 (setq associated associated2)) - (let* ((file (buffer-file-name - (or (buffer-base-buffer associated) - associated))) -(inode (when (and file - (fboundp 'file-attribute-inode-number)) - (file-attribute-inode-number - (file-attributes file -(hash (secure-hash 'md5 associated))) + (let ((cached (gethash associated org-persist--associated-buffer-cache)) + file inode hash) + (if (and cached (eq (buffer-modified-tick associated) + (car cached))) + (progn + (setq file (nth 1 cached) + inode (nth 2 cached) + hash (nth 3 cached))) + (setq file (buffer-file-name + (or (buffer-base-buffer associated) + associated))) + (setq inode (when (and file +(fboundp 'file-attribute-inode-number)) + (file-attribute-inode-number +(file-attributes file + (setq hash (secure-hash 'md5 associated)) + (puthash associated + (list (buffer-modified-tick associated) +file inode hash) + org-persist--associated-buffer-cache)) (let ((rtn `(:hash ,hash))) (when file (setq rtn (plist-put rtn :file file))) (when inode (setq rtn (plist-put rtn :inode inode)))
[elpa] externals/org dc52c0fe99 17/31: Fix native-comp warnings
branch: externals/org commit dc52c0fe992dd07d5915c034526812764a2ae574 Author: Ihor Radchenko Commit: Ihor Radchenko Fix native-comp warnings --- lisp/org-persist.el | 5 + lisp/org.el | 1 + 2 files changed, 6 insertions(+) diff --git a/lisp/org-persist.el b/lisp/org-persist.el index cd1a499e16..4552dd4f2e 100644 --- a/lisp/org-persist.el +++ b/lisp/org-persist.el @@ -148,6 +148,11 @@ (require 'org-id) (require 'xdg nil t) +(declare-function org-back-to-heading "org" (&optional invisible-ok)) +(declare-function org-next-visible-heading "org" (arg)) +(declare-function org-at-heading-p "org" (&optional invisible-not-ok)) + + (defconst org-persist--storage-version "2.2" "Persistent storage layout version.") diff --git a/lisp/org.el b/lisp/org.el index 4bd8a6c994..4e27c69261 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -204,6 +204,7 @@ Stars are put in group 1 and the trimmed body in group 2.") (defvar org-agenda-buffer-name) (defvar org-element-paragraph-separate) +(defvar org-element-cache-map-continue-from) (defvar org-indent-indentation-per-level) (defvar org-radio-target-regexp) (defvar org-target-link-regexp)
[elpa] externals/org ac5742f296 31/31: Merge branch 'feature/org-persist-new-tidy'
branch: externals/org commit ac5742f296a75f9234191f5550c644b9a5bcbc35 Merge: 22e6ed6b89 7014675226 Author: Ihor Radchenko Commit: Ihor Radchenko Merge branch 'feature/org-persist-new-tidy' --- lisp/org-element.el | 73 ++-- lisp/org-persist.el | 1072 +++ lisp/org.el |5 +- 3 files changed, 862 insertions(+), 288 deletions(-) diff --git a/lisp/org-element.el b/lisp/org-element.el index b82475a14e..77a9fc6e3e 100644 --- a/lisp/org-element.el +++ b/lisp/org-element.el @@ -7054,43 +7054,53 @@ The element is: %S\n The real element is: %S\n Cache around :begin:\n%S\n%S\n%S" ;;; Cache persistance -(defun org-element--cache-persist-before-write (var &optional buffer) +(defun org-element--cache-persist-before-write (container &optional associated) "Sync cache before saving." - (when (and org-element-use-cache - buffer - org-element-cache-persistent - (eq var 'org-element--cache) - (derived-mode-p 'org-mode) - org-element--cache) -(with-current-buffer buffer - ;; Cleanup cache request keys to avoid collisions during next - ;; Emacs session. - (avl-tree-mapc - (lambda (el) - (org-element-put-property el :org-element--cache-sync-key nil)) - org-element--cache) - (org-with-wide-buffer - (org-element-at-point (point-max -nil)) - -(defun org-element--cache-persist-before-read (var &optional buffer) + (when (equal container '(elisp org-element--cache)) +(if (and org-element-use-cache + (plist-get associated :file) + (get-file-buffer (plist-get associated :file)) + org-element-cache-persistent) +(with-current-buffer (get-file-buffer (plist-get associated :file)) + (if (and (derived-mode-p 'org-mode) + org-element--cache) + (progn +;; Cleanup cache request keys to avoid collisions during next +;; Emacs session. +(avl-tree-mapc + (lambda (el) + (org-element-put-property el :org-element--cache-sync-key nil)) + org-element--cache) +(org-with-wide-buffer + (org-element-at-point (point-max))) +nil) +'forbid)) + 'forbid))) + +(defun org-element--cache-persist-before-read (container &optional associated) "Avoid reading cache before Org mode is loaded." - (when (memq var '(org-element--cache org-element--headline-cache)) -(if (not buffer) 'forbid - (with-current-buffer buffer + (when (equal container '(elisp org-element--cache)) +(if (not (and (plist-get associated :file) +(get-file-buffer (plist-get associated :file +'forbid + (with-current-buffer (get-file-buffer (plist-get associated :file)) (unless (and org-element-use-cache org-element-cache-persistent - (derived-mode-p 'org-mode)) + (derived-mode-p 'org-mode) + (equal (secure-hash 'md5 (current-buffer)) +(plist-get associated :hash))) 'forbid) -(defun org-element--cache-persist-after-read (var &optional buffer) +(defun org-element--cache-persist-after-read (container &optional associated) "Setup restored cache." - (with-current-buffer buffer -(when (and org-element-use-cache org-element-cache-persistent) - (when (and (eq var 'org-element--cache) org-element--cache) -(setq-local org-element--cache-size (avl-tree-size org-element--cache))) - (when (and (eq var 'org-element--headline-cache) org-element--headline-cache) -(setq-local org-element--headline-cache-size (avl-tree-size org-element--headline-cache)) + (when (and (plist-get associated :file) + (get-file-buffer (plist-get associated :file))) +(with-current-buffer (get-file-buffer (plist-get associated :file)) + (when (and org-element-use-cache org-element-cache-persistent) +(when (and (equal container '(elisp org-element--cache)) org-element--cache) + (setq-local org-element--cache-size (avl-tree-size org-element--cache))) +(when (and (equal container '(elisp org-element--headline-cache)) org-element--headline-cache) + (setq-local org-element--headline-cache-size (avl-tree-size org-element--headline-cache))) (add-hook 'org-persist-before-write-hook #'org-element--cache-persist-before-write) (add-hook 'org-persist-before-read-hook #'org-element--cache-persist-before-read) @@ -7115,7 +7125,8 @@ buffers." (when (not org-element-cache-persistent) (org-persist-unregister 'org-element--headline-cache (current-buffer)) (org-persist-unregister 'org-element--cache (current-buffer))) -(when org-element-cache-persistent +(when (and org-element-cache
[elpa] externals/org-remark 30e879c6ac: docs: minor update to user manual
branch: externals/org-remark commit 30e879c6ac531f24a28a0ddd5359cf470c71b32f Author: Noboru Ota Commit: Noboru Ota docs: minor update to user manual --- docs/org-remark.org | 16 +++- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/docs/org-remark.org b/docs/org-remark.org index 120c407d69..4a05167c5a 100644 --- a/docs/org-remark.org +++ b/docs/org-remark.org @@ -1,15 +1,13 @@ #+title: Org-remark User Manual #+author: Noboru Ota -#+macro: version 0.1.x -#+macro: modified 28 January 2022 - +#+macro: version 0.2.x +#+macro: modified 29 January 2022 #+language: en #+export_file_name: org-remark.texi #+texinfo_dir_category: Emacs #+texinfo_dir_title: Org-remark: (org-remark) #+texinfo_dir_desc: Highlight and annotate any text file #+texinfo: @paragraphindent asis - #+options: toc:nil ':t #+ATTR_TEXINFO: :tag CAUTION @@ -240,14 +238,12 @@ This command will show you a list of available pens to choose from. It will remove the highlight and the properties from the marginal notes file, but will keep the headline and annotations. This is to ensure to keep any notes you might have written intact. You can let this command DELETE the entire heading subtree for the highlight along with the annotations you have written, by passing a universal argument with ~C-u~. If you have done so by error, you could still ~undo~ it in the marginal notes buffer, but not from within the current buffer as adding and removing overlays are not part of the undo tree. -To navigate through highlights in the current buffer, you can use ~org-remark-view-next~ / ~org-remark-view-prev~ or the following pair of commands. The former moves your cursor and displays the marginal notes buffer; the latter only moves your cursor. - - Command ~org-remark-delete~ :: Delete the highlight at POINT and marginal notes for it. This function will prompt for confirmation if there is any notes present in the marginal notes buffer. When the marginal notes buffer is not displayed in the current frame, it will be temporarily displayed together with the prompt for the user to see the notes. - If there is no notes, this function will not prompt for confirmation and will remove the highlight and deletes the entry in the marginal notes buffer. - This command is identical with passing a universal argument to -`org-remark-remove'. + If there is no notes, this function will not prompt for confirmation and will remove the highlight and deletes the entry in the marginal notes buffer. This command is identical with passing a universal argument to `org-remark-remove'. + +To navigate through highlights in the current buffer, you can use ~org-remark-view-next~ / ~org-remark-view-prev~ or the following pair of commands. The former moves your cursor and displays the marginal notes buffer; the latter only moves your cursor. - Command ~org-remark-next~ :: Move to the next highlight, if any. @@ -310,6 +306,8 @@ Org-remark's user options are available in the customization group ~org-remark~. - Moving source files and remark file :: Move your files and remark file to another directory does not update the source path recorded in the remark file. It will be confusing. Try not to do it. +- Marginal notes file uses absolute path :: Related to the previous limitation. The marginal notes file serves as the database for the highlights' locations and notes. The linkage back to the main note files are via absolute paths. This means moving files to a different path is likely to break the the links. + * Credits To create this package, I was inspired by the following packages. I did not copy any part of them, but borrowed some ideas from them -- e.g. saving the margin notes in a separate file.
[elpa] externals/hyperbole fad08eedfb: Add hypb--installation-type with test and use it (#157)
branch: externals/hyperbole commit fad08eedfb452368337a0f9049c23247c01c0fcf Author: Mats Lidell Commit: GitHub Add hypb--installation-type with test and use it (#157) --- ChangeLog | 8 +++- hypb.el| 20 ++-- test/hypb-tests.el | 31 +-- 3 files changed, 54 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index ae1ebd2b37..96908c3db2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,11 @@ -2022-01-25 Bob Weiner +2022-01-28 Mats Lidell + +* test/hypb-tests.el (hypb--installation-type-test): Add unit test. +* hypb.el (hypb--installation-type, hypb:configuration): Add function to +provide installation type and version number and use it. + +2022-01-25 Bob Weiner * kotl/kotl-mode.el (kotl-mode:copy-region-to-buffer): Fix interactive args listed in wrong order. diff --git a/hypb.el b/hypb.el index 5d524bcbb6..ef55c7c775 100644 --- a/hypb.el +++ b/hypb.el @@ -3,9 +3,9 @@ ;; Author: Bob Weiner ;; ;; Orig-Date: 6-Oct-91 at 03:42:38 -;; Last-Mod: 24-Jan-22 at 00:21:55 by Bob Weiner +;; Last-Mod: 28-Jan-22 at 23:49:07 by Mats Lidell ;; -;; Copyright (C) 1991-2019 Free Software Foundation, Inc. +;; Copyright (C) 1991-2022 Free Software Foundation, Inc. ;; See the "HY-COPY" file for license information. ;; ;; This file is part of GNU Hyperbole. @@ -107,6 +107,19 @@ Global keymap is used unless optional KEYMAP is given." "}")) (error "(hypb:cmd-key-string): Invalid cmd-sym arg: %s" cmd-sym))) +(defun hypb--installation-type () + "Return type of Hyperbole installation." + (let ((hypb-dir-name (file-name-nondirectory (directory-file-name hyperb:dir +(cond + ;; elpa-devel install -- hyperbole-8.0.0pre0.20220126.1138 + ((string-match "hyperbole-\\([.[:digit:]]+pre[.[:digit:]]+\\).*" hypb-dir-name) + (list "elpa-devel" (match-string 1 hypb-dir-name))) + ;; git + ((file-exists-p (expand-file-name ".git" hyperb:dir)) + (ignore-errors +(let ((default-directory hyperb:dir)) + (list "git" (shell-command-to-string "git rev-parse HEAD" + ;;;###autoload (defun hypb:configuration (&optional out-buf) "Insert Emacs configuration information at the end of optional OUT-BUF or the current buffer." @@ -147,6 +160,9 @@ Global keymap is used unless optional KEYMAP is given." (concat "PIEmail " pm-version)) (when (and (boundp 'hnews:reader) (boundp 'gnus-version) hnews:reader) (insert (format "\tNews Reader: %s\n" gnus-version))) + (let ((install-type (hypb--installation-type))) +(when install-type + (insert (format "\tInstall: %s, %s" (car install-type) (cadr install-type) (insert "\n") ;; Insert recent Hyperbole debugging messages if any. (when (get-buffer "*Messages*") diff --git a/test/hypb-tests.el b/test/hypb-tests.el index fefff6a0bc..479959176b 100644 --- a/test/hypb-tests.el +++ b/test/hypb-tests.el @@ -3,9 +3,9 @@ ;; Author: Mats Lidell ;; ;; Orig-Date: 5-Apr-21 at 18:53:10 -;; Last-Mod: 24-Jan-22 at 00:41:04 by Bob Weiner +;; Last-Mod: 28-Jan-22 at 23:49:07 by Mats Lidell ;; -;; Copyright (C) 2021 Free Software Foundation, Inc. +;; Copyright (C) 2022 Free Software Foundation, Inc. ;; See the "HY-COPY" file for license information. ;; ;; This file is part of GNU Hyperbole. @@ -19,6 +19,7 @@ (require 'hypb) (require 'hbut) (require 'ert) +(require 'el-mock) ;; Test for replace-regexp-in-string copied from emacs src (ert-deftest hypb:replace-match-string-test () @@ -91,5 +92,31 @@ (should (equal (hypb:replace-match-string "\\`\\|x" "--xx--" "z") "z--zz--" +(ert-deftest hypb--installation-type-test () + "Verify installation type alternatives." + (let ((hyperb:dir "/home/user/.emacs.d/elpa/hyperbole-8.0.0pre0.20220126.1138")) +(should (equal (hypb--installation-type) '("elpa-devel" "8.0.0pre0.20220126.1138" + (let ((hyperb:dir "/a_git_folder")) +(with-mock + (mock (file-exists-p "/a_git_folder/.git") => t) + (mock (shell-command-to-string "git rev-parse HEAD") => "abcdefg") + (should (equal (hypb--installation-type) '("git" "abcdefg") + (let ((hyperb:dir "/a_git_folder")) +(with-mock + (mock (file-exists-p "/a_git_folder/.git") => t) + (cl-letf (((symbol-function 'shell-command-to-string) + (lambda (_cmd) (error "Something bad happend" +(should (equal (hypb--installation-type) '("git" "abcdefg")) + (let ((hyperb:dir "/a_git_folder")) +(with-mock + (mock (file-exists-p "/a_git_folder/.git") => nil) + (should-not (hypb--installation-type) + +;; This file can't be byte-compiled without the `el-mock' package (because of +;; the use of the `with-mock' macro), which is not a dependency of Hyperbole. +;; Local Variables: +;; no-byte-compile:
[elpa] externals/org-remark 65f6b84ab2: docs: minor formatting update to user manual
branch: externals/org-remark commit 65f6b84ab29eb168aac36e94bff51cb8dcb4692c Author: Noboru Ota Commit: Noboru Ota docs: minor formatting update to user manual --- docs/org-remark.org | 7 ++- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/docs/org-remark.org b/docs/org-remark.org index 4a05167c5a..b467ce404a 100644 --- a/docs/org-remark.org +++ b/docs/org-remark.org @@ -230,8 +230,7 @@ Org-remark displays the marginal notes buffer narrowed to the highlight the curs If you would like to hide/show the highlights in the current buffer, it is recommended to use this command instead of ~org-remark-mode~. This command only affects the display of the highlights and their locations are still kept tracked. Toggling off ~org-remark-mode~ stops this tracking completely, which will likely result in inconsistency between the marginal notes file and the current main buffer. - Command ~org-remark-change~ :: - Change the highlight at point to one by another pen. -This command will show you a list of available pens to choose from. + Change the highlight at point to one by another pen. This command will show you a list of available pens to choose from. - Command ~org-remark-remove~ :: Remove the highlight at point. @@ -248,9 +247,7 @@ To navigate through highlights in the current buffer, you can use ~org-remark-vi - Command ~org-remark-next~ :: Move to the next highlight, if any. If there is none below the point but there is a highlight in the buffer, cycle back to the first one. - After the point has moved to the next highlight, this command -lets you move further by re-entering only the last letter like -this example: =C-n ] ] ] ] ]= (assuming this command is bound to C-n ]) + After the point has moved to the next highlight, this command lets you move further by re-entering only the last letter like this example: =C-n ] ] ] ] ]= (assuming this command is bound to C-n ]) - Command ~org-remark-prev~ :: Move to the previous highlight, if any.
[nongnu] main 13d2c5c67f 08/12: * elpa-packages (graphql-mode): Add package
branch: main commit 13d2c5c67f5fa3187ccb35911f4346aafb664819 Author: Philip Kaludercic Commit: Philip Kaludercic * elpa-packages (graphql-mode): Add package --- elpa-packages | 3 +++ 1 file changed, 3 insertions(+) diff --git a/elpa-packages b/elpa-packages index fae73a71cc..22258ae564 100644 --- a/elpa-packages +++ b/elpa-packages @@ -192,6 +192,9 @@ ("gruvbox-theme" :url "https://github.com/greduan/emacs-theme-gruvbox.git"; :ignored-files ("images" "palette")) + ("graphql-mode" :url "https://github.com/davazp/graphql-mode"; + :ignored-files ("test")) + ("guru-mode" :url "https://github.com/bbatsov/guru-mode";) ("haml-mode" :url "https://github.com/nex3/haml-mode";
[nongnu] main ecb84d343d 02/12: * elpa-packages (free-keys): Add package
branch: main commit ecb84d343d3ba4a7f9b62fd3485816061a1f7001 Author: Philip Kaludercic Commit: Philip Kaludercic * elpa-packages (free-keys): Add package --- elpa-packages | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/elpa-packages b/elpa-packages index 86d27af1b0..0c818a4148 100644 --- a/elpa-packages +++ b/elpa-packages @@ -142,10 +142,12 @@ ("forth-mode" :url "https://github.com/larsbrinkhoff/forth-mode"; :ignored-files ("test" "Makefile" "compile.el")) + ("free-keys" :url "https://github.com/Fuco1/free-keys";) + ("git-commit" :url "https://github.com/magit/magit"; :lisp-dir "lisp" :ignored-files - ("LICENSE" ".github" ".mailmap" + ("LICENSE" ".github" ".mailsdopcmap" "docs" "Makefile" "default.mk" "lisp/Makefile" "lisp/*-pkg.el" "test" "README.md" "RelNotes.org" "lisp/git-rebase.el" "lisp/magit-*.el" "lisp/magit.el"))
[nongnu] main a0520320c8 09/12: * elpa-packages (raku-mode): Add package
branch: main commit a0520320c87d7dddeadbcc43a4e461e490209adf Author: Philip Kaludercic Commit: Philip Kaludercic * elpa-packages (raku-mode): Add package --- elpa-packages | 4 1 file changed, 4 insertions(+) diff --git a/elpa-packages b/elpa-packages index 22258ae564..2bf95baf63 100644 --- a/elpa-packages +++ b/elpa-packages @@ -401,6 +401,10 @@ ("prop-menu" :url "https://github.com/david-christiansen/prop-menu-el"; :ignored-files ("Makefile" "prop-menu-tests.el")) + ("raku-mode" :url "https://github.com/Raku/raku-mode"; + :ignored-files ("test" "Cask" "Makefile" "npq-mode.el") + :news "CHANGELOG.md") + ("request":url "https://github.com/tkf/emacs-request"; :ignored-files ("tests" "doc" "COPYING"))
[nongnu] main 73f394f68b 01/12: * elpa-packages (forth-mode): Add package
branch: main commit 73f394f68bfab589cb38d9754a733c2a77a4ec98 Author: Philip Kaludercic Commit: Philip Kaludercic * elpa-packages (forth-mode): Add package --- elpa-packages | 3 +++ 1 file changed, 3 insertions(+) diff --git a/elpa-packages b/elpa-packages index 11f2d42b08..86d27af1b0 100644 --- a/elpa-packages +++ b/elpa-packages @@ -139,6 +139,9 @@ ("flymake-kondor" :url "https://github.com/turbo-cafe/flymake-kondor"; :ignored-files ("COPYING.txt")) + ("forth-mode" :url "https://github.com/larsbrinkhoff/forth-mode"; + :ignored-files ("test" "Makefile" "compile.el")) + ("git-commit" :url "https://github.com/magit/magit"; :lisp-dir "lisp" :ignored-files
[nongnu] main d5fa8ada91 10/12: * elpa-packages (elpher): Add package
branch: main commit d5fa8ada918f5e71b418150187cf634b87941299 Author: Philip Kaludercic Commit: Philip Kaludercic * elpa-packages (elpher): Add package --- elpa-packages | 4 1 file changed, 4 insertions(+) diff --git a/elpa-packages b/elpa-packages index 2bf95baf63..41f80ec53d 100644 --- a/elpa-packages +++ b/elpa-packages @@ -98,6 +98,10 @@ :news "CHANGELOG.md" :ignored-files ("LICENSE" "bin" "ert-tests")) + ("elpher" :url "git://thelambdalab.xyz/elpher.git" + :doc "elpher.texi" + :ignored-files ("Makefile" "ISSUES.org" "RELEASE" "config.mk")) + ("evil" :url "https://github.com/emacs-evil/evil"; :ignored-files ("COPYING" "lib" "scripts") :doc "doc/build/texinfo/evil.texi")
[nongnu] main 9ab5d84ac9 12/12: * elpa-packages (elixir-mode): Add package
branch: main commit 9ab5d84ac9c61cbbfec9b8635b4274bd1d555654 Author: Philip Kaludercic Commit: Philip Kaludercic * elpa-packages (elixir-mode): Add package --- elpa-packages | 4 1 file changed, 4 insertions(+) diff --git a/elpa-packages b/elpa-packages index ab555c3b8d..2c9d8ffc53 100644 --- a/elpa-packages +++ b/elpa-packages @@ -98,6 +98,10 @@ :news "CHANGELOG.md" :ignored-files ("LICENSE" "bin" "ert-tests")) + ("elixir-mode":url "https://github.com/elixir-editors/emacs-elixir"; + :ignored-files ("tests" "Eldev") + :news "CHANGELOG.md") + ("elpher" :url "git://thelambdalab.xyz/elpher.git" :doc "elpher.texi" :ignored-files ("Makefile" "ISSUES.org" "RELEASE" "config.mk"))
[nongnu] main 9498a87c2f 11/12: * elpa-packages (helm, helm-code): Add packages
branch: main commit 9498a87c2f18f34060fe4ea6f9f0b7a4ee1038b3 Author: Philip Kaludercic Commit: Philip Kaludercic * elpa-packages (helm, helm-code): Add packages --- elpa-packages | 19 ++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/elpa-packages b/elpa-packages index 41f80ec53d..ab555c3b8d 100644 --- a/elpa-packages +++ b/elpa-packages @@ -223,7 +223,24 @@ ;; ;; https://github.com/haskell/haskell-mode/releases/tag/17.2 ;; :version-map ((nil "17.2" "e72677668f5fc7cc148008e885a0f256e245dd43"))) - ("highlight-parentheses" :url "https://git.sr.ht/~tsdh/highlight-parentheses.el"; + ("helm" :url "https://github.com/emacs-helm/helm"; + :ignored-files ("images" "Cask" "Makefile" "emacs-helm.sh" "helm-core-pkg.el" "helm.el" + "helm-lib.el" "helm-source.el" "helm-multi-match.el")) + + ("helm-core" :url "https://github.com/emacs-helm/helm"; + :ignored-files ("images" "Cask" "Makefile" "emacs-helm.sh" "helm-adaptive.el" + "helm-bookmark.el" "helm-buffers.el" "helm-color.el" "helm-comint.el" + "helm-command.el" "helm-config.el" "helm-dabbrev.el" "helm-easymenu.el" + "helm-elisp.el" "helm-elisp-package.el" "helm-epa.el" "helm-eshell.el" + "helm-eval.el" "helm-external.el" "helm-fd.el" "helm-files.el" "helm-find.el" + "helm-font.el" "helm-for-files.el" "helm-global-bindings.el" "helm-grep.el" + "helm-help.el" "helm-id-utils.el" "helm-imenu.el" "helm-info.el" "helm-locate.el" + "helm-man.el" "helm-misc.el" "helm-mode.el" "helm-net.el" "helm-occur.el" + "helm-pkg.el" "helm-regexp.el" "helm-ring.el" "helm-semantic.el" "helm-shell.el" + "helm-sys.el" "helm-tags.el" "helm-types.el" "helm-utils.el" "helm-x-files.el") + :main-file "helm.el") + + ("highlight-parentheses" :url "https://git.sr.ht/~tsdh/highlight-parentheses.el"; :branch "main" :readme "README.md" :ignored-files ("LICENSE"))
[nongnu] main fa4d0e837d 05/12: * elpa-packages (kotlin-mode): Add package
branch: main commit fa4d0e837dac85e55d383dd53b3620b76cce05bd Author: Philip Kaludercic Commit: Philip Kaludercic * elpa-packages (kotlin-mode): Add package --- elpa-packages | 3 +++ 1 file changed, 3 insertions(+) diff --git a/elpa-packages b/elpa-packages index 69e0c6ac10..62cfac69b7 100644 --- a/elpa-packages +++ b/elpa-packages @@ -252,6 +252,9 @@ ("lua-mode" :url "https://github.com/immerrr/lua-mode/"; :ignored-files ("COPYING" "test" "travis" "init-tryout.el")) + ("kotlin-mode":url "https://github.com/Emacs-Kotlin-Mode-Maintainers/kotlin-mode"; + :ignored-files ("doc" "test" "Cask" "Makefile")) + ("magit" :url "https://github.com/magit/magit"; :lisp-dir "lisp" :doc "docs/magit.texi"
[nongnu] elpa/dockerfile-mode 922845c229 002/104: Added dockerfile-mode.el
branch: elpa/dockerfile-mode commit 922845c22981fa11eadf59cb114a65954b6874b8 Author: Drew Csillag Commit: Drew Csillag Added dockerfile-mode.el --- dockerfile-mode.el | 101 + 1 file changed, 101 insertions(+) diff --git a/dockerfile-mode.el b/dockerfile-mode.el new file mode 100644 index 00..1dc5460ce1 --- /dev/null +++ b/dockerfile-mode.el @@ -0,0 +1,101 @@ +;;; Copyright (c) 2013 Spotify AB +;;; +;;; Licensed under the Apache License, Version 2.0 (the "License"); you may not +;;; use this file except in compliance with the License. You may obtain a copy of +;;; the License at +;;; +;;; http://www.apache.org/licenses/LICENSE-2.0 +;;; +;;; Unless required by applicable law or agreed to in writing, software +;;; distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +;;; WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +;;; License for the specific language governing permissions and limitations under +;;; the License. + +(require 'sh-script) + +(defvar docker-image-name nil) + +(defgroup dockerfile nil + "dockerfile code editing commands for Emacs." + :link '(custom-group-link :tag "Font Lock Faces group" font-lock-faces) + :prefix "dockerfile-" + :group 'languages) + +(defcustom dockerfile-mode-hook nil + "*Hook called by `dockerfile-mode'." + :type 'hook + :group 'dockerfile) + +(defvar dockerfile-mode-syntax-table nil + "Syntax table used while in `dockerfile-mode'.") +(setq dockerfile-mode-syntax-table (make-syntax-table)) +(modify-syntax-entry ?\# "<" dockerfile-mode-syntax-table) +(modify-syntax-entry ?\n ">" dockerfile-mode-syntax-table) + +(defvar dockerfile-font-lock-keywords + `( +("#.*$" . font-lock-comment-face) + ("\\b\\([Ff][Rr][Oo][Mm]\\|[mM][aA][iI][nN][tT][aA][iI][nN][eE][rR]\\|[rR][uU][nN]\\|[eE][nN][vV]\\|[cC][mM][dD]\\|[eE][xX][pP][oO][sS][eE]\\|[iI][nN][sS][eE][rR][tT]\\|[cC][oO][pP][yY]\\|[eE][nN][tT][rR][yY][pP][oO][iI][nN][tT]\\|[vV][oO][lL][uU][mM][eE]\\|[aA][dD][dD]\\)\\b" . font-lock-keyword-face) +,@(sh-font-lock-keywords) +,@(sh-font-lock-keywords-2) +,@(sh-font-lock-keywords-1) +) + "Default font-lock-keywords for `dockerfile mode'.") + +(defvar dockerfile-mode-map + (let ((map (make-sparse-keymap)) + (menu-map (make-sparse-keymap))) +(define-key map "\C-c\C-b" 'dockerfile-build-buffer) +(define-key map "\C-c\C-z" 'dockerfile-test-function) +(define-key map "\C-c\C-c" 'comment-region) +(define-key map [menu-bar dockerfile-mode] (cons "Dockerfile" menu-map)) +(define-key menu-map [dfc] + '(menu-item "Comment Region" comment-region + :help "Comment Region")) +(define-key menu-map [dfb] + '(menu-item "Build" dockerfile-build-buffer + :help "Send the Dockerfile to docker build")) +map)) + +(defvar dockerfile-mode-abbrev-table nil + "Abbrev table used while in `dockerfile-mode'.") + +(unless dockerfile-mode-abbrev-table + (define-abbrev-table 'dockerfile-mode-abbrev-table ())) + +(defun dockerfile-build-buffer (image-name) + "Build an image based upon the buffer" + (interactive + (if (null docker-image-name) + (list (read-string "image-name:" nil nil)) + (list docker-image-name))) + (save-buffer) + (shell-command + (concat "docker build -t " image-name " " (file-name-directory (buffer-file-name)) "&") + "*docker-build-output*") + (switch-to-buffer "*docker-build-output*")) + +;;;###autoload +(defun dockerfile-mode () + "A major mode to edit Dockerfiles. +\\{dockerfile-mode-map} +" + (interactive) + (kill-all-local-variables) + (use-local-map dockerfile-mode-map) + + (make-local-variable 'comment-start) + (setq comment-start "#") + (make-local-variable 'parse-sexp-ignore-comments) + (setq parse-sexp-ignore-comments t) + (setq local-abbrev-table dockerfile-mode-abbrev-table) + + (make-local-variable 'font-lock-defaults) + (setq major-mode 'dockerfile-mode + mode-name "dockerfile" + font-lock-defaults '(dockerfile-font-lock-keywords nil)) + (set-syntax-table dockerfile-mode-syntax-table) + (run-mode-hooks 'dockerfile-mode-hook)) + +(provide 'dockerfile-mode)
[nongnu] branch elpa/dockerfile-mode created (now 5db94549ce)
elpasync pushed a change to branch elpa/dockerfile-mode. at 5db94549ce Add a toggle for auto indentation This branch includes the following new commits: new 37ef4643fc Added essentials new 922845c229 Added dockerfile-mode.el new 3f460b6de0 Error check docker-image-name and give helpful error message new 58179938b2 Only recognize Dockerfile keywords at beginning of the line new 98434943c3 Adjust auto-mode regexp in README. new 7f92c17b99 Option to use sudo when invoking docker builder new c462ba8650 Merge pull request #1 from thomasf/master new 2e2f7231fc Various fixes and improvements new 1fd094a409 Merge pull request #2 from purcell/patch-1 new 730b2dbd84 Update Dockerfile keywords to match docker 0.7.6 new 1e5e7a3c82 Merge pull request #3 from thomasf/master new fbe1353f3f add ONBUILD new 2530eb8d01 Merge pull request #4 from vieux/master new 6ed974d462 Autoload docker mode for Dockerfiles. new 2fbc75ed98 Merge pull request #5 from mikelaspina/autoload-auto-mode new 1015f3818d Added copy and onbuild commands new 29f60881d2 add a space after : in image name prompt new 472c405828 Merge pull request #8 from mgalgs/prompt-space new fadac401c8 added note about emacs compatibility new fb7bb1e444 Add support for custom Dockerfiles new 4e6a0f62c0 Use format instead of concat new 8771eb1d9a Use async-shell-command instead of shell-command new a532e30371 Use syntax highlighting in README new 4d3ccfd569 Merge pull request #9 from Silex/master new e20c7e587a Correctly set require-final-newline new e16c164db2 Merge pull request #10 from j0ni/accommodate-ethan-wspace new 6b60974e74 Add autoload marker for `dockerfile-build-buffer` new 8d18510480 Merge pull request #14 from Silex/master new 6a64806b78 now treats single quotes like double quotes new 34a0a5d082 Merge branch 'master' of github.com:spotify/dockerfile-mode new 95f55f3697 add dockerfile-build-no-cache-buffer new cfa634ff1d Merge pull request #18 from nabeo/add_dockerfile-build-no-cache-buffer new 88efae4e78 dockerfile-mode.el: add LABEL to the list of known keywords new 9a75fcd119 Merge pull request #19 from giuseppe/giuseppe/color-label new 8f74b941d2 Add support for ARG command new 40be396417 Merge pull request #20 from djui/patch-1 new d1e9754285 Fix build failure when path of Dockerfile contains spaces. new 6fcecb517d Merge pull request #21 from jaccarmac/fix-space-regression new 35d10860d9 Fix inability to build images on Windows. new fd1cf02f06 Merge pull request #22 from jaccarmac/fix-windows-build new fe02469020 add a STOPSIGNAL Dockerfile instruction from docker 1.9.0 new 53434afa3b Merge pull request #23 from nabeo/add_stopsignal_to_font_lock_keywaords new 26239c3b95 Resolve spotify/#24 new fdebd1eda5 Pass --build-args to docker build new 8273401efa Merge pull request #26 from rcj/master new 93d6013437 Resolve spotify/#24 new a464ee6e91 Merge branch 'master' of github.com:davidshen84/dockerfile-mode new bebfa1b73e Merge pull request #25 from davidshen84/master new b99346c738 Add missing keywords shell and healthcheck. new 5f1e17e4e5 Merge pull request #27 from ju2wheels/feature/add_missing_keywords new 89dba6d115 Treat = as punctuation. new 3c6bc90360 Merge pull request #29 from Wilfred/equals_as_punctuation new 5dad943a19 Fix overly-general auto-mode-alist entry new ca679539c4 Fix naming of unprefixed symbol new a690935648 Make no attempt to support antiquated Emacsen < 24 new 5c60ad7a78 Rename image name variable, and read it consistently new a0faf92cc9 Use shell-quote-argument to protect against unsafe strings in commands new 40d83ba7c6 Include image name in build output buffer name new fd7bba9f4a default-directory is the easier way to get the working directory new 712302d04d Drop unnecessary use of "format" new 52f821c9cd Add missing package dependency on "s" new 37b7290b11 Add Homepage and Commentary headers new 39f35d927f Prefer compilation-mode to async-shell-command new 69bfba7acc Merge pull request #31 from purcell/master new b53020b781 Add custom `dockerfile-use-sudo` type and group new 76dc76256a Add adequate quoting to documentation new 1f4e9261e0 Add adequate casing to documented argument new e6d5598bf0 Add adequate spacing to documentation new cd102cffa1 Merge pull request #34 from wynro/master new d607a90673 mention it is available via MELPA new 4ab78f678e Merge pull request #36 from spotify/readme-melpa new 05f8d76e2e Recognize Dockerfile files
[nongnu] elpa/dockerfile-mode 37ef4643fc 001/104: Added essentials
branch: elpa/dockerfile-mode commit 37ef4643fc57db406d0c850d4d6d00f0b4566f1c Author: Drew Csillag Commit: Drew Csillag Added essentials --- .gitignore | 1 + LICENSE| 202 + README.md | 18 ++ 3 files changed, 221 insertions(+) diff --git a/.gitignore b/.gitignore new file mode 100644 index 00..b25c15b81f --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +*~ diff --git a/LICENSE b/LICENSE new file mode 100644 index 00..43b7c542e4 --- /dev/null +++ b/LICENSE @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 +http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensab
[nongnu] elpa/dockerfile-mode 6ed974d462 014/104: Autoload docker mode for Dockerfiles.
branch: elpa/dockerfile-mode commit 6ed974d4626cf6256f2430fdfc05630668948f9c Author: msl Commit: msl Autoload docker mode for Dockerfiles. --- dockerfile-mode.el | 1 + 1 file changed, 1 insertion(+) diff --git a/dockerfile-mode.el b/dockerfile-mode.el index 8c85246e2a..459866c42e 100644 --- a/dockerfile-mode.el +++ b/dockerfile-mode.el @@ -106,6 +106,7 @@ '(dockerfile-font-lock-keywords nil t)) (setq local-abbrev-table dockerfile-mode-abbrev-table)) +;;;###autoload (add-to-list 'auto-mode-alist '("Dockerfile\\'" . dockerfile-mode)) (provide 'dockerfile-mode)
[nongnu] elpa/dockerfile-mode 98434943c3 005/104: Adjust auto-mode regexp in README.
branch: elpa/dockerfile-mode commit 98434943c3cac60301ff74fff74a78b8baf79353 Author: Thomas Frössman Commit: Thomas Frössman Adjust auto-mode regexp in README. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 87e160d2a8..52db15d50c 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ A Dockerfile mode for emacs (add-to-list 'load-path "/your/path/to/dockerfile-mode/") (require 'dockerfile-mode) -(add-to-list 'auto-mode-alist '("Dockerfile" . dockerfile-mode)) +(add-to-list 'auto-mode-alist '("Dockerfile\\'" . dockerfile-mode)) Adds syntax highlighting as well as the ability to build the image directly (C-c C-b) from the buffer.
[nongnu] elpa/dockerfile-mode 3f460b6de0 003/104: Error check docker-image-name and give helpful error message
branch: elpa/dockerfile-mode commit 3f460b6de03438ba7db120a29ce0404b7749a1ec Author: Drew Csillag Commit: Drew Csillag Error check docker-image-name and give helpful error message --- dockerfile-mode.el | 10 ++ 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/dockerfile-mode.el b/dockerfile-mode.el index 1dc5460ce1..ad648380c0 100644 --- a/dockerfile-mode.el +++ b/dockerfile-mode.el @@ -71,10 +71,11 @@ (list (read-string "image-name:" nil nil)) (list docker-image-name))) (save-buffer) - (shell-command - (concat "docker build -t " image-name " " (file-name-directory (buffer-file-name)) "&") - "*docker-build-output*") - (switch-to-buffer "*docker-build-output*")) + (if (stringp image-name) + (shell-command + (concat "docker build -t " image-name " " (file-name-directory (buffer-file-name)) "&") + "*docker-build-output*") +(print "docker-image-name must be a string, consider surrounding it with double quotes"))) ;;;###autoload (defun dockerfile-mode () @@ -99,3 +100,4 @@ (run-mode-hooks 'dockerfile-mode-hook)) (provide 'dockerfile-mode) +
[nongnu] elpa/dockerfile-mode e20c7e587a 025/104: Correctly set require-final-newline
branch: elpa/dockerfile-mode commit e20c7e587a77ca5eabcb893b9b5687610b0e490c Author: J Irving Commit: J Irving Correctly set require-final-newline Emacs provides `mode-require-final-newline` to allow users to control the behaviour of modes (like `dockerfile-mode`) which are designed to control the final newline in a file. The intent is that this is set to `t` by default - modes that wish to ensure a final newline should set `require-final-newline` to `mode-require-final-newline`, allowing users to override this behaviour. See http://www.gnu.org/software/emacs/manual/html_node/emacs/Customize-Save.html for more detail. One specific use case where this is important is `ethan-wpace`, which implements a more sophisticated whitespace policy. Some examples of how sidestepping this convention can be a problem can be found in issues glasserc/ethan-wspace#22 and glasserc/ethan-wspace#25. --- dockerfile-mode.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dockerfile-mode.el b/dockerfile-mode.el index dba2fc37a0..a15f5b8473 100644 --- a/dockerfile-mode.el +++ b/dockerfile-mode.el @@ -97,7 +97,7 @@ \\{dockerfile-mode-map} " (set-syntax-table dockerfile-mode-syntax-table) - (set (make-local-variable 'require-final-newline) t) + (set (make-local-variable 'require-final-newline) mode-require-final-newline) (set (make-local-variable 'comment-start) "#") (set (make-local-variable 'comment-end) "") (set (make-local-variable 'comment-start-skip) "#+ *")
[nongnu] elpa/dockerfile-mode 8771eb1d9a 022/104: Use async-shell-command instead of shell-command
branch: elpa/dockerfile-mode commit 8771eb1d9a6a40d19c88072869efab347e54ed23 Author: Philippe Vaucher Commit: Philippe Vaucher Use async-shell-command instead of shell-command --- dockerfile-mode.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dockerfile-mode.el b/dockerfile-mode.el index 4267bf5aba..dba2fc37a0 100644 --- a/dockerfile-mode.el +++ b/dockerfile-mode.el @@ -82,8 +82,8 @@ (list docker-image-name))) (save-buffer) (if (stringp image-name) - (shell-command - (format "%s docker build -t %s -f %s %s &" (if dockerfile-use-sudo "sudo" "") image-name (buffer-file-name) (file-name-directory (buffer-file-name))) + (async-shell-command + (format "%s docker build -t %s -f %s %s" (if dockerfile-use-sudo "sudo" "") image-name (buffer-file-name) (file-name-directory (buffer-file-name))) "*docker-build-output*") (print "docker-image-name must be a string, consider surrounding it with double quotes")))
[nongnu] elpa/dockerfile-mode 1015f3818d 016/104: Added copy and onbuild commands
branch: elpa/dockerfile-mode commit 1015f3818db98bcafaa59ddc0c780cc9fe9db9b4 Author: Drew Csillag Commit: Drew Csillag Added copy and onbuild commands --- dockerfile-mode.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dockerfile-mode.el b/dockerfile-mode.el index 459866c42e..ee8791f685 100644 --- a/dockerfile-mode.el +++ b/dockerfile-mode.el @@ -38,7 +38,7 @@ (defvar dockerfile-font-lock-keywords `(,(cons (rx (or line-start "onbuild ") (group (or "from" "maintainer" "run" "cmd" "expose" "env" - "add" "entrypoint" "volume" "user" "workdir")) + "add" "copy" "entrypoint" "volume" "user" "workdir" "onbuild")) word-boundary) font-lock-keyword-face) ,@(sh-font-lock-keywords)
[nongnu] elpa/dockerfile-mode 472c405828 018/104: Merge pull request #8 from mgalgs/prompt-space
branch: elpa/dockerfile-mode commit 472c405828a09174b4289c1233e66d75d5dc44a4 Merge: 1015f3818d 29f60881d2 Author: Drew Csillag Commit: Drew Csillag Merge pull request #8 from mgalgs/prompt-space add a space after : in image name prompt --- dockerfile-mode.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dockerfile-mode.el b/dockerfile-mode.el index ee8791f685..468d2f6edc 100644 --- a/dockerfile-mode.el +++ b/dockerfile-mode.el @@ -78,7 +78,7 @@ "Build an image based upon the buffer" (interactive (if (null docker-image-name) - (list (read-string "image-name:" nil nil)) + (list (read-string "image-name: " nil nil)) (list docker-image-name))) (save-buffer) (if (stringp image-name)
[nongnu] elpa/dockerfile-mode a532e30371 023/104: Use syntax highlighting in README
branch: elpa/dockerfile-mode commit a532e30371b1a2708a6445433dd368a232d36277 Author: Philippe Vaucher Commit: Philippe Vaucher Use syntax highlighting in README --- README.md | 12 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index c3c7fb8501..d389f044a9 100644 --- a/README.md +++ b/README.md @@ -4,9 +4,11 @@ Known to work with Emacs 24 and later A Dockerfile mode for emacs -(add-to-list 'load-path "/your/path/to/dockerfile-mode/") -(require 'dockerfile-mode) -(add-to-list 'auto-mode-alist '("Dockerfile\\'" . dockerfile-mode)) +``` emacs-lisp +(add-to-list 'load-path "/your/path/to/dockerfile-mode/") +(require 'dockerfile-mode) +(add-to-list 'auto-mode-alist '("Dockerfile\\'" . dockerfile-mode)) +``` Adds syntax highlighting as well as the ability to build the image directly (C-c C-b) from the buffer. @@ -14,6 +16,8 @@ directly (C-c C-b) from the buffer. You can specify the image name in the file itself by adding a line like this at the top of your Dockerfile. -## -*- docker-image-name: "your-image-name-here" -*- +``` emacs-lisp +## -*- docker-image-name: "your-image-name-here" -*- +``` If you don't, you'll be prompted for an image name each time you build.
[nongnu] elpa/dockerfile-mode 8f74b941d2 035/104: Add support for ARG command
branch: elpa/dockerfile-mode commit 8f74b941d20e2b0387826632bdb9da2a659b7491 Author: Uwe Dauernheim Commit: Uwe Dauernheim Add support for ARG command Docker 1.8 introduced the `ARG` command which can be used in combination with `docker build --build-arg`. See: https://github.com/docker/docker/blob/master/CHANGELOG.md#builder --- dockerfile-mode.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dockerfile-mode.el b/dockerfile-mode.el index e4f072b559..0e37485848 100644 --- a/dockerfile-mode.el +++ b/dockerfile-mode.el @@ -37,7 +37,7 @@ (defvar dockerfile-font-lock-keywords `(,(cons (rx (or line-start "onbuild ") - (group (or "from" "maintainer" "run" "cmd" "expose" "env" + (group (or "from" "maintainer" "run" "cmd" "expose" "env" "arg" "add" "copy" "entrypoint" "volume" "user" "workdir" "onbuild" "label")) word-boundary)
[nongnu] elpa/dockerfile-mode 34a0a5d082 030/104: Merge branch 'master' of github.com:spotify/dockerfile-mode
branch: elpa/dockerfile-mode commit 34a0a5d082609883ef667937c8bcf7eaec91a7e5 Merge: 6a64806b78 8d18510480 Author: Drew Csillag Commit: Drew Csillag Merge branch 'master' of github.com:spotify/dockerfile-mode --- dockerfile-mode.el | 1 + 1 file changed, 1 insertion(+) diff --git a/dockerfile-mode.el b/dockerfile-mode.el index ee1889746d..c3bc7fffa4 100644 --- a/dockerfile-mode.el +++ b/dockerfile-mode.el @@ -75,6 +75,7 @@ (unless dockerfile-mode-abbrev-table (define-abbrev-table 'dockerfile-mode-abbrev-table ())) +;;;###autoload (defun dockerfile-build-buffer (image-name) "Build an image based upon the buffer" (interactive
[nongnu] elpa/dockerfile-mode 4e6a0f62c0 021/104: Use format instead of concat
branch: elpa/dockerfile-mode commit 4e6a0f62c0af4a081f1c7a0f0e13e5c6f07568a6 Author: Philippe Vaucher Commit: Philippe Vaucher Use format instead of concat --- dockerfile-mode.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dockerfile-mode.el b/dockerfile-mode.el index ff01bff055..4267bf5aba 100644 --- a/dockerfile-mode.el +++ b/dockerfile-mode.el @@ -83,7 +83,7 @@ (save-buffer) (if (stringp image-name) (shell-command - (concat (if dockerfile-use-sudo "sudo " "") "docker build -t " image-name " -f " (buffer-file-name) " " (file-name-directory (buffer-file-name)) "&") + (format "%s docker build -t %s -f %s %s &" (if dockerfile-use-sudo "sudo" "") image-name (buffer-file-name) (file-name-directory (buffer-file-name))) "*docker-build-output*") (print "docker-image-name must be a string, consider surrounding it with double quotes")))
[nongnu] elpa/dockerfile-mode 26239c3b95 043/104: Resolve spotify/#24
branch: elpa/dockerfile-mode commit 26239c3b950ee738db2d1a9935f1198428ab0fc7 Author: Xi Shen Commit: Xi Shen Resolve spotify/#24 Use `cygwin-convert-file-name-to-windows' to handle filename in Cygwin environment, and `convert-standard-filename' in other POSIX environment. --- dockerfile-mode.el | 24 +--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/dockerfile-mode.el b/dockerfile-mode.el index b14eae99b8..19a14f7807 100644 --- a/dockerfile-mode.el +++ b/dockerfile-mode.el @@ -19,6 +19,8 @@ (require 'sh-script) (require 'rx) +(declare-function cygwin-convert-file-name-to-windows "cygw32.c" (file &optional absolute-p)) + (defvar docker-image-name nil) (defgroup dockerfile nil @@ -80,6 +82,14 @@ (unless dockerfile-mode-abbrev-table (define-abbrev-table 'dockerfile-mode-abbrev-table ())) +(defun standard-filename (file) + "Convert the file name to OS standard. +If in Cygwin environment, uses Cygwin specific function to convert the +file name. Otherwise, uses Emacs' standard conversion function." + (format "%s" (if (fboundp 'cygwin-convert-file-name-to-windows) + (s-replace "\\" "" (cygwin-convert-file-name-to-windows file)) +(convert-standard-filename file + ;;;###autoload (defun dockerfile-build-buffer (image-name) "Build an image based upon the buffer" @@ -90,7 +100,11 @@ (save-buffer) (if (stringp image-name) (async-shell-command - (format "%sdocker build -t %s -f \"%s\" \"%s\"" (if dockerfile-use-sudo "sudo " "") image-name (buffer-file-name) (file-name-directory (buffer-file-name))) + (format "%sdocker build -t %s -f \"%s\" \"%s\"" + (if dockerfile-use-sudo "sudo " "") + image-name + (standard-filename (buffer-file-name)) + (standard-filename (file-name-directory (buffer-file-name "*docker-build-output*") (print "docker-image-name must be a string, consider surrounding it with double quotes"))) @@ -104,9 +118,13 @@ (save-buffer) (if (stringp image-name) (async-shell-command - (format "%s docker build --no-cache -t %s -f \"%s\" \"%s\"" (if dockerfile-use-sudo "sudo" "") image-name (buffer-file-name) (file-name-directory (buffer-file-name))) + (format "%s docker build --no-cache -t %s -f \"%s\" \"%s\"" + (if dockerfile-use-sudo "sudo" "") + image-name + (standard-filename (buffer-file-name)) + (standard-filename (file-name-directory (buffer-file-name))) "*docker-build-output*") -(print "docker-image-name must be a string, consider surrounding it with double quotes"))) +(print "docker-image-name must be a string, consider surrounding it with double quotes" ;; Handle emacs < 24, which does not have prog-mode (defalias 'dockerfile-parent-mode
[nongnu] elpa/dockerfile-mode 93d6013437 046/104: Resolve spotify/#24
branch: elpa/dockerfile-mode commit 93d60134376532ad89772f4c2d6e41b349e97b30 Author: Xi Shen Commit: Xi Shen Resolve spotify/#24 Use `cygwin-convert-file-name-to-windows' to handle filename in Cygwin environment, and `convert-standard-filename' in other POSIX environment. --- dockerfile-mode.el | 28 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/dockerfile-mode.el b/dockerfile-mode.el index bbdae27737..0bd78aef53 100644 --- a/dockerfile-mode.el +++ b/dockerfile-mode.el @@ -19,6 +19,8 @@ (require 'sh-script) (require 'rx) +(declare-function cygwin-convert-file-name-to-windows "cygw32.c" (file &optional absolute-p)) + (defvar docker-image-name nil) (defgroup dockerfile nil @@ -93,17 +95,30 @@ Each element of the list will be passed as a separate (mapconcat (lambda (arg) (concat "--build-arg " "\"" arg "\"")) dockerfile-build-args " ")) +(defun standard-filename (file) + "Convert the file name to OS standard. +If in Cygwin environment, uses Cygwin specific function to convert the +file name. Otherwise, uses Emacs' standard conversion function." + (format "%s" (if (fboundp 'cygwin-convert-file-name-to-windows) + (s-replace "\\" "" (cygwin-convert-file-name-to-windows file)) + (convert-standard-filename file + ;;;###autoload (defun dockerfile-build-buffer (image-name) "Build an image based upon the buffer" (interactive (if (null docker-image-name) - (list (read-string "image-name: " nil nil)) + (list (read-string "image-name: " nil nil)) (list docker-image-name))) (save-buffer) (if (stringp image-name) (async-shell-command - (format "%sdocker build -t %s %s -f \"%s\" \"%s\"" (if dockerfile-use-sudo "sudo " "") image-name (dockerfile-build-arg-string) (buffer-file-name) (file-name-directory (buffer-file-name))) + (format "%sdocker build -t %s %s -f \"%s\" \"%s\"" + (if dockerfile-use-sudo "sudo " "") + image-name + (dockerfile-build-arg-string) + (standard-filename (buffer-file-name)) + (standard-filename (file-name-directory (buffer-file-name "*docker-build-output*") (print "docker-image-name must be a string, consider surrounding it with double quotes"))) @@ -112,12 +127,17 @@ Each element of the list will be passed as a separate "Build an image based upon the buffer without cache" (interactive (if (null docker-image-name) - (list (read-string "image-name: " nil nil)) + (list (read-string "image-name: " nil nil)) (list docker-image-name))) (save-buffer) (if (stringp image-name) (async-shell-command - (format "%s docker build --no-cache -t %s %s -f \"%s\" \"%s\"" (if dockerfile-use-sudo "sudo" "") image-name (dockerfile-build-arg-string) (buffer-file-name) (file-name-directory (buffer-file-name))) + (format "%s docker build --no-cache -t %s %s -f \"%s\" \"%s\"" + (if dockerfile-use-sudo "sudo" "") + image-name + (dockerfile-build-arg-string) + (standard-filename (buffer-file-name)) + (standard-filename (file-name-directory (buffer-file-name "*docker-build-output*") (print "docker-image-name must be a string, consider surrounding it with double quotes")))
[nongnu] elpa/dockerfile-mode ca679539c4 054/104: Fix naming of unprefixed symbol
branch: elpa/dockerfile-mode commit ca679539c411596fb4e295571308d92df8a70071 Author: Steve Purcell Commit: Steve Purcell Fix naming of unprefixed symbol --- dockerfile-mode.el | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/dockerfile-mode.el b/dockerfile-mode.el index db79c36004..2c30a465f6 100644 --- a/dockerfile-mode.el +++ b/dockerfile-mode.el @@ -96,7 +96,7 @@ Each element of the list will be passed as a separate (mapconcat (lambda (arg) (concat "--build-arg " "\"" arg "\"")) dockerfile-build-args " ")) -(defun standard-filename (file) +(defun dockerfile-standard-filename (file) "Convert the file name to OS standard. If in Cygwin environment, uses Cygwin specific function to convert the file name. Otherwise, uses Emacs' standard conversion function." @@ -118,8 +118,8 @@ file name. Otherwise, uses Emacs' standard conversion function." (if dockerfile-use-sudo "sudo " "") image-name (dockerfile-build-arg-string) - (standard-filename (buffer-file-name)) - (standard-filename (file-name-directory (buffer-file-name + (dockerfile-standard-filename (buffer-file-name)) + (dockerfile-standard-filename (file-name-directory (buffer-file-name "*docker-build-output*") (print "docker-image-name must be a string, consider surrounding it with double quotes"))) @@ -137,8 +137,8 @@ file name. Otherwise, uses Emacs' standard conversion function." (if dockerfile-use-sudo "sudo" "") image-name (dockerfile-build-arg-string) - (standard-filename (buffer-file-name)) - (standard-filename (file-name-directory (buffer-file-name + (dockerfile-standard-filename (buffer-file-name)) + (dockerfile-standard-filename (file-name-directory (buffer-file-name "*docker-build-output*") (print "docker-image-name must be a string, consider surrounding it with double quotes")))
[nongnu] elpa/dockerfile-mode 2e2f7231fc 008/104: Various fixes and improvements
branch: elpa/dockerfile-mode commit 2e2f7231fc345087acbf879b5ab9d29ec87551e7 Author: Steve Purcell Commit: Steve Purcell Various fixes and improvements * Use standard header/footer lines for compatibility with package.el * Include auto-mode-alist entry by default * Use a proper mode definition rather than a plain function * Support comments via the syntax table, not font lock keywords * Use define-abbrev-table where appropriate * Specify keywords more concisely, and pass "case-fold" flag with font-lock defaults to allow case insensitivity --- dockerfile-mode.el | 96 +- 1 file changed, 52 insertions(+), 44 deletions(-) diff --git a/dockerfile-mode.el b/dockerfile-mode.el index 58c2e4e40d..c9b25545fe 100644 --- a/dockerfile-mode.el +++ b/dockerfile-mode.el @@ -1,18 +1,23 @@ -;;; Copyright (c) 2013 Spotify AB -;;; -;;; Licensed under the Apache License, Version 2.0 (the "License"); you may not -;;; use this file except in compliance with the License. You may obtain a copy of -;;; the License at -;;; -;;; http://www.apache.org/licenses/LICENSE-2.0 -;;; -;;; Unless required by applicable law or agreed to in writing, software -;;; distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -;;; WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -;;; License for the specific language governing permissions and limitations under -;;; the License. +;;; dockerfile-mode.el --- Major mode for editing Docker's Dockerfiles + +;; Copyright (c) 2013 Spotify AB +;; +;; Licensed under the Apache License, Version 2.0 (the "License"); you may not +;; use this file except in compliance with the License. You may obtain a copy of +;; the License at +;; +;; http://www.apache.org/licenses/LICENSE-2.0 +;; +;; Unless required by applicable law or agreed to in writing, software +;; distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +;; WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +;; License for the specific language governing permissions and limitations under +;; the License. + +;;; Code: (require 'sh-script) +(require 'rx) (defvar docker-image-name nil) @@ -30,38 +35,41 @@ (defcustom dockerfile-use-sudo nil "Runs docker builder command with sudo.") -(defvar dockerfile-mode-syntax-table nil - "Syntax table used while in `dockerfile-mode'.") -(setq dockerfile-mode-syntax-table (make-syntax-table)) -(modify-syntax-entry ?\# "<" dockerfile-mode-syntax-table) -(modify-syntax-entry ?\n ">" dockerfile-mode-syntax-table) - (defvar dockerfile-font-lock-keywords - `( -("#.*$" . font-lock-comment-face) - ("^\\([Ff][Rr][Oo][Mm]\\|[mM][aA][iI][nN][tT][aA][iI][nN][eE][rR]\\|[rR][uU][nN]\\|[eE][nN][vV]\\|[cC][mM][dD]\\|[eE][xX][pP][oO][sS][eE]\\|[iI][nN][sS][eE][rR][tT]\\|[cC][oO][pP][yY]\\|[eE][nN][tT][rR][yY][pP][oO][iI][nN][tT]\\|[vV][oO][lL][uU][mM][eE]\\|[aA][dD][dD]\\)\\b" . font-lock-keyword-face) + `(,(cons (rx line-start + (group (or "from" "maintainer" "run" "env" "cmd" + "expose" "insert" "copy" "entrypoint" + "volume" "add")) + word-boundary) + font-lock-keyword-face) ,@(sh-font-lock-keywords) ,@(sh-font-lock-keywords-2) -,@(sh-font-lock-keywords-1) -) +,@(sh-font-lock-keywords-1)) "Default font-lock-keywords for `dockerfile mode'.") (defvar dockerfile-mode-map (let ((map (make-sparse-keymap)) - (menu-map (make-sparse-keymap))) +(menu-map (make-sparse-keymap))) (define-key map "\C-c\C-b" 'dockerfile-build-buffer) (define-key map "\C-c\C-z" 'dockerfile-test-function) (define-key map "\C-c\C-c" 'comment-region) (define-key map [menu-bar dockerfile-mode] (cons "Dockerfile" menu-map)) (define-key menu-map [dfc] '(menu-item "Comment Region" comment-region - :help "Comment Region")) + :help "Comment Region")) (define-key menu-map [dfb] '(menu-item "Build" dockerfile-build-buffer - :help "Send the Dockerfile to docker build")) + :help "Send the Dockerfile to docker build")) map)) -(defvar dockerfile-mode-abbrev-table nil +(defvar dockerfile-mode-syntax-table + (let ((table (make-syntax-table))) +(modify-syntax-entry ?# "<" table) +(modify-syntax-entry ?\n ">" table) +table) + "Syntax table for `dockerfile-mode'.") + +(define-abbrev-table 'dockerfile-mode-abbrev-table nil "Abbrev table used while in `dockerfile-mode'.") (unless dockerfile-mode-abbrev-table @@ -80,27 +88,27 @@ "*docker-build-output*") (print "docker-image-name must be a string, consider surrounding it with double quotes"))) +;; Handle emacs < 24, which does not have prog-mode +(defalias 'dockerfile-parent-mode + (if (fboundp 'prog-mode) 'prog-mode 'fundamental-mode)) + ;;;###autoload -(def
[nongnu] elpa/dockerfile-mode 4d3ccfd569 024/104: Merge pull request #9 from Silex/master
branch: elpa/dockerfile-mode commit 4d3ccfd569e1d79ef77af28c8daa9d1ddf8735e9 Merge: fadac401c8 a532e30371 Author: Rohan Singh Commit: Rohan Singh Merge pull request #9 from Silex/master Add support for custom Dockerfiles --- README.md | 12 dockerfile-mode.el | 6 +++--- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index c3c7fb8501..d389f044a9 100644 --- a/README.md +++ b/README.md @@ -4,9 +4,11 @@ Known to work with Emacs 24 and later A Dockerfile mode for emacs -(add-to-list 'load-path "/your/path/to/dockerfile-mode/") -(require 'dockerfile-mode) -(add-to-list 'auto-mode-alist '("Dockerfile\\'" . dockerfile-mode)) +``` emacs-lisp +(add-to-list 'load-path "/your/path/to/dockerfile-mode/") +(require 'dockerfile-mode) +(add-to-list 'auto-mode-alist '("Dockerfile\\'" . dockerfile-mode)) +``` Adds syntax highlighting as well as the ability to build the image directly (C-c C-b) from the buffer. @@ -14,6 +16,8 @@ directly (C-c C-b) from the buffer. You can specify the image name in the file itself by adding a line like this at the top of your Dockerfile. -## -*- docker-image-name: "your-image-name-here" -*- +``` emacs-lisp +## -*- docker-image-name: "your-image-name-here" -*- +``` If you don't, you'll be prompted for an image name each time you build. diff --git a/dockerfile-mode.el b/dockerfile-mode.el index 468d2f6edc..dba2fc37a0 100644 --- a/dockerfile-mode.el +++ b/dockerfile-mode.el @@ -82,8 +82,8 @@ (list docker-image-name))) (save-buffer) (if (stringp image-name) - (shell-command - (concat (if dockerfile-use-sudo "sudo " "") "docker build -t " image-name " " (file-name-directory (buffer-file-name)) "&") + (async-shell-command + (format "%s docker build -t %s -f %s %s" (if dockerfile-use-sudo "sudo" "") image-name (buffer-file-name) (file-name-directory (buffer-file-name))) "*docker-build-output*") (print "docker-image-name must be a string, consider surrounding it with double quotes"))) @@ -107,7 +107,7 @@ (setq local-abbrev-table dockerfile-mode-abbrev-table)) ;;;###autoload -(add-to-list 'auto-mode-alist '("Dockerfile\\'" . dockerfile-mode)) +(add-to-list 'auto-mode-alist '("Dockerfile.*\\'" . dockerfile-mode)) (provide 'dockerfile-mode)
[nongnu] elpa/dockerfile-mode 53434afa3b 042/104: Merge pull request #23 from nabeo/add_stopsignal_to_font_lock_keywaords
branch: elpa/dockerfile-mode commit 53434afa3b56eb9284d5e2c21956e43046cae1fa Merge: fd1cf02f06 fe02469020 Author: Drew Csillag Commit: Drew Csillag Merge pull request #23 from nabeo/add_stopsignal_to_font_lock_keywaords add a STOPSIGNAL Dockerfile instruction to font lock keywords --- dockerfile-mode.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dockerfile-mode.el b/dockerfile-mode.el index c83820e11e..b14eae99b8 100644 --- a/dockerfile-mode.el +++ b/dockerfile-mode.el @@ -39,7 +39,7 @@ `(,(cons (rx (or line-start "onbuild ") (group (or "from" "maintainer" "run" "cmd" "expose" "env" "arg" "add" "copy" "entrypoint" "volume" "user" "workdir" "onbuild" - "label")) + "label" "stopsignal")) word-boundary) font-lock-keyword-face) ,@(sh-font-lock-keywords)
[nongnu] elpa/dockerfile-mode 39f35d927f 063/104: Prefer compilation-mode to async-shell-command
branch: elpa/dockerfile-mode commit 39f35d927fc51063d06bfffd88e34cc359b18f29 Author: Steve Purcell Commit: Steve Purcell Prefer compilation-mode to async-shell-command This allows `recompile` to work conveniently, and provides support for jumping to errors found in the output. --- dockerfile-mode.el | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/dockerfile-mode.el b/dockerfile-mode.el index 344109cd6f..ca131af588 100644 --- a/dockerfile-mode.el +++ b/dockerfile-mode.el @@ -1,4 +1,4 @@ -;;; dockerfile-mode.el --- Major mode for editing Docker's Dockerfiles +;;; dockerfile-mode.el --- Major mode for editing Docker's Dockerfiles -*- lexical-binding: t -*- ;; Copyright (c) 2013 Spotify AB ;; Package-Requires: ((emacs "24") (s "1.12")) @@ -132,7 +132,7 @@ If prefix arg NO-CACHE is set, don't cache the image." (interactive (list (dockerfile-read-image-name) prefix-arg)) (save-buffer) (if (stringp image-name) - (async-shell-command + (compilation-start (format "%sdocker build %s -t %s %s -f %s %s" (if dockerfile-use-sudo "sudo " "") @@ -141,7 +141,8 @@ If prefix arg NO-CACHE is set, don't cache the image." (dockerfile-build-arg-string) (shell-quote-argument (dockerfile-standard-filename (buffer-file-name))) (shell-quote-argument (dockerfile-standard-filename default-directory))) - (format "*docker-build-output: %s *" image-name)) + nil + (lambda (_) (format "*docker-build-output: %s *" image-name))) (print "dockerfile-image-name must be a string, consider surrounding it with double quotes"))) ;;;###autoload
[nongnu] elpa/dockerfile-mode cfa634ff1d 032/104: Merge pull request #18 from nabeo/add_dockerfile-build-no-cache-buffer
branch: elpa/dockerfile-mode commit cfa634ff1dd9b4414d7e42cd1d5de9b8b6fbd56d Merge: 34a0a5d082 95f55f3697 Author: Drew Csillag Commit: Drew Csillag Merge pull request #18 from nabeo/add_dockerfile-build-no-cache-buffer add dockerfile-build-no-cache-buffer --- dockerfile-mode.el | 18 ++ 1 file changed, 18 insertions(+) diff --git a/dockerfile-mode.el b/dockerfile-mode.el index c3bc7fffa4..8c6509e909 100644 --- a/dockerfile-mode.el +++ b/dockerfile-mode.el @@ -50,6 +50,7 @@ (let ((map (make-sparse-keymap)) (menu-map (make-sparse-keymap))) (define-key map "\C-c\C-b" 'dockerfile-build-buffer) +(define-key map "\C-c\M-b" 'dockerfile-build-no-cache-buffer) (define-key map "\C-c\C-z" 'dockerfile-test-function) (define-key map "\C-c\C-c" 'comment-region) (define-key map [menu-bar dockerfile-mode] (cons "Dockerfile" menu-map)) @@ -59,6 +60,9 @@ (define-key menu-map [dfb] '(menu-item "Build" dockerfile-build-buffer :help "Send the Dockerfile to docker build")) +(define-key menu-map [dfb] + '(menu-item "Build without cache" dockerfile-build-no-cache-buffer + :help "Send the Dockerfile to docker build without cache")) map)) (defvar dockerfile-mode-syntax-table @@ -89,6 +93,20 @@ "*docker-build-output*") (print "docker-image-name must be a string, consider surrounding it with double quotes"))) +;;;###autoload +(defun dockerfile-build-no-cache-buffer (image-name) + "Build an image based upon the buffer without cache" + (interactive + (if (null docker-image-name) + (list (read-string "image-name: " nil nil)) + (list docker-image-name))) + (save-buffer) + (if (stringp image-name) + (async-shell-command + (format "%s docker build --no-cache -t %s -f %s %s" (if dockerfile-use-sudo "sudo" "") image-name (buffer-file-name) (file-name-directory (buffer-file-name))) + "*docker-build-output*") +(print "docker-image-name must be a string, consider surrounding it with double quotes"))) + ;; Handle emacs < 24, which does not have prog-mode (defalias 'dockerfile-parent-mode (if (fboundp 'prog-mode) 'prog-mode 'fundamental-mode))
[nongnu] elpa/dockerfile-mode 40d83ba7c6 058/104: Include image name in build output buffer name
branch: elpa/dockerfile-mode commit 40d83ba7c6e171c8d1c580a234d6041d5b2b70b2 Author: Steve Purcell Commit: Steve Purcell Include image name in build output buffer name This allows several images to be built simultaneously. --- dockerfile-mode.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dockerfile-mode.el b/dockerfile-mode.el index e1fa5e7bca..ef0b7a3733 100644 --- a/dockerfile-mode.el +++ b/dockerfile-mode.el @@ -132,7 +132,7 @@ If prefix arg NO-CACHE is set, don't cache the image." (dockerfile-build-arg-string) (shell-quote-argument (dockerfile-standard-filename (buffer-file-name))) (shell-quote-argument (dockerfile-standard-filename (file-name-directory (buffer-file-name) - "*docker-build-output*") + (format "*docker-build-output: %s *" image-name)) (print "dockerfile-image-name must be a string, consider surrounding it with double quotes"))) ;;;###autoload
[nongnu] elpa/dockerfile-mode 1f4e9261e0 067/104: Add adequate casing to documented argument
branch: elpa/dockerfile-mode commit 1f4e9261e0f6ebd380ad158ea5d54d6b787fc9a4 Author: Guillermo Robles Commit: Guillermo Robles Add adequate casing to documented argument --- dockerfile-mode.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dockerfile-mode.el b/dockerfile-mode.el index ecadeb79f0..6975f7c68a 100644 --- a/dockerfile-mode.el +++ b/dockerfile-mode.el @@ -107,7 +107,7 @@ Each element of the list will be passed as a separate dockerfile-build-args " ")) (defun dockerfile-standard-filename (file) - "Convert the file name to OS standard. + "Convert the FILE name to OS standard. If in Cygwin environment, uses Cygwin specific function to convert the file name. Otherwise, uses Emacs' standard conversion function." (if (fboundp 'cygwin-convert-file-name-to-windows)
[nongnu] elpa/dockerfile-mode 40be396417 036/104: Merge pull request #20 from djui/patch-1
branch: elpa/dockerfile-mode commit 40be396417535c6721c1b13ca9f99c46192f1d73 Merge: 9a75fcd119 8f74b941d2 Author: Drew Csillag Commit: Drew Csillag Merge pull request #20 from djui/patch-1 Add support for ARG command --- dockerfile-mode.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dockerfile-mode.el b/dockerfile-mode.el index e4f072b559..0e37485848 100644 --- a/dockerfile-mode.el +++ b/dockerfile-mode.el @@ -37,7 +37,7 @@ (defvar dockerfile-font-lock-keywords `(,(cons (rx (or line-start "onbuild ") - (group (or "from" "maintainer" "run" "cmd" "expose" "env" + (group (or "from" "maintainer" "run" "cmd" "expose" "env" "arg" "add" "copy" "entrypoint" "volume" "user" "workdir" "onbuild" "label")) word-boundary)
[nongnu] elpa/dockerfile-mode 902e4c2a5a 075/104: Add faces for image name and alias
branch: elpa/dockerfile-mode commit 902e4c2a5a80d8481bc08fd18a474c23ef2c1d3e Author: Matus Goljer Commit: Matus Goljer Add faces for image name and alias --- dockerfile-mode.el | 11 +++ 1 file changed, 11 insertions(+) diff --git a/dockerfile-mode.el b/dockerfile-mode.el index f031ff20be..9c9933a8b2 100644 --- a/dockerfile-mode.el +++ b/dockerfile-mode.el @@ -55,6 +55,14 @@ Each element of the list will be passed as a separate :type '(repeat string) :group 'dockerfile) +(defface dockerfile-image-name + '((t (:inherit (font-lock-type-face bold + "Face to highlight the base image name after FROM instruction.") + +(defface dockerfile-image-alias + '((t (:inherit (font-lock-constant-face bold + "Face to highlight the base image alias inf FROM ... AS construct.") + (defvar dockerfile-font-lock-keywords `(,(cons (rx (or line-start "onbuild ") (group (or "from" "maintainer" "run" "cmd" "expose" "env" "arg" @@ -62,6 +70,9 @@ Each element of the list will be passed as a separate "label" "stopsignal" "shell" "healthcheck")) word-boundary) font-lock-keyword-face) +(,(rx "FROM " (group (+? nonl)) (or " " eol) (? "as " (group (1+ nonl + (1 'dockerfile-image-name) + (2 'dockerfile-image-alias nil t)) ,@(sh-font-lock-keywords) ,@(sh-font-lock-keywords-2) ,@(sh-font-lock-keywords-1))
[nongnu] elpa/dockerfile-mode 69bfba7acc 064/104: Merge pull request #31 from purcell/master
branch: elpa/dockerfile-mode commit 69bfba7acc6bda0d0a5834c3774fffc145337a63 Merge: 3c6bc90360 39f35d927f Author: Drew Csillag Commit: GitHub Merge pull request #31 from purcell/master Collection of fixes and improvements --- dockerfile-mode.el | 95 -- 1 file changed, 50 insertions(+), 45 deletions(-) diff --git a/dockerfile-mode.el b/dockerfile-mode.el index 793de05c8d..ca131af588 100644 --- a/dockerfile-mode.el +++ b/dockerfile-mode.el @@ -1,6 +1,8 @@ -;;; dockerfile-mode.el --- Major mode for editing Docker's Dockerfiles +;;; dockerfile-mode.el --- Major mode for editing Docker's Dockerfiles -*- lexical-binding: t -*- ;; Copyright (c) 2013 Spotify AB +;; Package-Requires: ((emacs "24") (s "1.12")) +;; Homepage: https://github.com/spotify/dockerfile-mode ;; ;; Licensed under the Apache License, Version 2.0 (the "License"); you may not ;; use this file except in compliance with the License. You may obtain a copy of @@ -14,14 +16,20 @@ ;; License for the specific language governing permissions and limitations under ;; the License. +;;; Commentary: + +;; Provides a major mode `dockerfile-mode' for use with the standard +;; `Dockerfile' file format. Additional convenience functions allow +;; images to be built easily. + ;;; Code: (require 'sh-script) (require 'rx) +(require 's) -(declare-function cygwin-convert-file-name-to-windows "cygw32.c" (file &optional absolute-p)) -(defvar docker-image-name nil) +(declare-function cygwin-convert-file-name-to-windows "cygw32.c" (file &optional absolute-p)) (defgroup dockerfile nil "dockerfile code editing commands for Emacs." @@ -93,61 +101,58 @@ Each element of the list will be passed as a separate (defun dockerfile-build-arg-string () "Create a --build-arg string for each element in `dockerfile-build-args'." - (mapconcat (lambda (arg) (concat "--build-arg " "\"" arg "\"")) + (mapconcat (lambda (arg) (concat "--build-arg " (shell-quote-argument arg))) dockerfile-build-args " ")) -(defun standard-filename (file) +(defun dockerfile-standard-filename (file) "Convert the file name to OS standard. If in Cygwin environment, uses Cygwin specific function to convert the file name. Otherwise, uses Emacs' standard conversion function." - (format "%s" (if (fboundp 'cygwin-convert-file-name-to-windows) - (s-replace "\\" "" (cygwin-convert-file-name-to-windows file)) - (convert-standard-filename file + (if (fboundp 'cygwin-convert-file-name-to-windows) + (s-replace "\\" "" (cygwin-convert-file-name-to-windows file)) +(convert-standard-filename file))) + +(defvar dockerfile-image-name nil + "Name of the dockerfile currently being used. +This can be set in file or directory-local variables.") +(define-obsolete-variable-alias 'docker-image-name 'dockerfile-image-name) + +(defvar dockerfile-image-name-history nil + "History of image names read by `dockerfile-read-image-name'.") + +(defun dockerfile-read-image-name () + "Read a docker image name." + (read-string "Image name: " dockerfile-image-name 'dockerfile-image-name-history)) + ;;;###autoload -(defun dockerfile-build-buffer (image-name) - "Build an image based upon the buffer" - (interactive - (if (null docker-image-name) - (list (read-string "image-name: " nil nil)) - (list docker-image-name))) +(defun dockerfile-build-buffer (image-name &optional no-cache) + "Build an image called IMAGE-NAME based upon the buffer. +If prefix arg NO-CACHE is set, don't cache the image." + (interactive (list (dockerfile-read-image-name) prefix-arg)) (save-buffer) (if (stringp image-name) - (async-shell-command - (format "%sdocker build -t %s %s -f \"%s\" \"%s\"" - (if dockerfile-use-sudo "sudo " "") - image-name - (dockerfile-build-arg-string) - (standard-filename (buffer-file-name)) - (standard-filename (file-name-directory (buffer-file-name - "*docker-build-output*") -(print "docker-image-name must be a string, consider surrounding it with double quotes"))) + (compilation-start + (format +"%sdocker build %s -t %s %s -f %s %s" +(if dockerfile-use-sudo "sudo " "") +(if no-cache "--no-cache" "") +(shell-quote-argument image-name) +(dockerfile-build-arg-string) +(shell-quote-argument (dockerfile-standard-filename (buffer-file-name))) +(shell-quote-argument (dockerfile-standard-filename default-directory))) + nil + (lambda (_) (format "*docker-build-output: %s *" image-name))) +(print "dockerfile-image-name must be a string, consider surrounding it with double quotes"))) ;;;###autoload (defun dockerfile-build-no-cache-buffer (image-name) - "Build an image based upon the buffer without cache" - (interactive - (if (null docker-image-name) - (lis
[nongnu] elpa/dockerfile-mode 6e1bf5dea4 074/104: README.md addition for safe-local-variable
branch: elpa/dockerfile-mode commit 6e1bf5dea4fa28dff61a6eecb69b05521f61962e Author: Adam Bloomston Commit: Adam Bloomston README.md addition for safe-local-variable --- README.md | 5 + 1 file changed, 5 insertions(+) diff --git a/README.md b/README.md index 9d94a4e909..88e40ecb8a 100644 --- a/README.md +++ b/README.md @@ -23,3 +23,8 @@ at the top of your Dockerfile. ``` If you don't, you'll be prompted for an image name each time you build. +You may want to add the following to your emacs config: + +``` emacs-lisp +(put 'dockerfile-image-name 'safe-local-variable #'stringp) +```
[nongnu] elpa/dockerfile-mode d607a90673 070/104: mention it is available via MELPA
branch: elpa/dockerfile-mode commit d607a90673a2c25def8856ca5e0ea3d64e0cd4d6 Author: Drew Csillag Commit: Drew Csillag mention it is available via MELPA --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index d389f044a9..9d94a4e909 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,8 @@ dockerfile-mode === Known to work with Emacs 24 and later +If you just want to use it, you can get it via MELPA. + A Dockerfile mode for emacs ``` emacs-lisp
[nongnu] elpa/dockerfile-mode 5f1e17e4e5 050/104: Merge pull request #27 from ju2wheels/feature/add_missing_keywords
branch: elpa/dockerfile-mode commit 5f1e17e4e59fee4725c5b4cd9b5b49f1faaa108f Merge: bebfa1b73e b99346c738 Author: Drew Csillag Commit: GitHub Merge pull request #27 from ju2wheels/feature/add_missing_keywords Add missing keywords shell and healthcheck. --- dockerfile-mode.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dockerfile-mode.el b/dockerfile-mode.el index 0bd78aef53..c4e4b91217 100644 --- a/dockerfile-mode.el +++ b/dockerfile-mode.el @@ -49,7 +49,7 @@ Each element of the list will be passed as a separate `(,(cons (rx (or line-start "onbuild ") (group (or "from" "maintainer" "run" "cmd" "expose" "env" "arg" "add" "copy" "entrypoint" "volume" "user" "workdir" "onbuild" - "label" "stopsignal")) + "label" "stopsignal" "shell" "healthcheck")) word-boundary) font-lock-keyword-face) ,@(sh-font-lock-keywords)
[nongnu] elpa/dockerfile-mode fd7bba9f4a 059/104: default-directory is the easier way to get the working directory
branch: elpa/dockerfile-mode commit fd7bba9f4a892fcbe17514a76a7e0805b38acb68 Author: Steve Purcell Commit: Steve Purcell default-directory is the easier way to get the working directory --- dockerfile-mode.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dockerfile-mode.el b/dockerfile-mode.el index ef0b7a3733..642711e8fe 100644 --- a/dockerfile-mode.el +++ b/dockerfile-mode.el @@ -131,7 +131,7 @@ If prefix arg NO-CACHE is set, don't cache the image." (shell-quote-argument image-name) (dockerfile-build-arg-string) (shell-quote-argument (dockerfile-standard-filename (buffer-file-name))) -(shell-quote-argument (dockerfile-standard-filename (file-name-directory (buffer-file-name) +(shell-quote-argument (dockerfile-standard-filename default-directory))) (format "*docker-build-output: %s *" image-name)) (print "dockerfile-image-name must be a string, consider surrounding it with double quotes")))
[nongnu] elpa/dockerfile-mode 7223d92718 081/104: Support indentation for comments
branch: elpa/dockerfile-mode commit 7223d92718f78fa3ab15667cdb2ed90cfeb579e7 Author: Terje Larsen Commit: Drew Csillag Support indentation for comments --- dockerfile-mode.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dockerfile-mode.el b/dockerfile-mode.el index c338ae78a8..9c9f61ec7e 100644 --- a/dockerfile-mode.el +++ b/dockerfile-mode.el @@ -120,8 +120,8 @@ Each element of the list will be passed as a separate Lines beginning with a keyword are ignored, and any others are indented by one `tab-width'." - (unless (eq (get-text-property (point-at-bol) 'face) - 'font-lock-keyword-face) + (unless (member (get-text-property (point-at-bol) 'face) + '(font-lock-comment-delimiter-face font-lock-keyword-face)) (save-excursion (beginning-of-line) (skip-chars-forward "[ \t]" (point-at-eol))
[nongnu] elpa/dockerfile-mode 730b2dbd84 010/104: Update Dockerfile keywords to match docker 0.7.6
branch: elpa/dockerfile-mode commit 730b2dbd849815ce6a76cdf8925ca3dfbc2b5ff0 Author: Thomas Frössman Commit: Thomas Frössman Update Dockerfile keywords to match docker 0.7.6 --- dockerfile-mode.el | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/dockerfile-mode.el b/dockerfile-mode.el index c9b25545fe..cdd49fd284 100644 --- a/dockerfile-mode.el +++ b/dockerfile-mode.el @@ -37,9 +37,8 @@ (defvar dockerfile-font-lock-keywords `(,(cons (rx line-start - (group (or "from" "maintainer" "run" "env" "cmd" - "expose" "insert" "copy" "entrypoint" - "volume" "add")) + (group (or "from" "maintainer" "run" "cmd" "expose" "env" + "add" "entrypoint" "volume" "user" "workdir")) word-boundary) font-lock-keyword-face) ,@(sh-font-lock-keywords)
[nongnu] elpa/dockerfile-mode 6a56c1cc17 089/104: Remove dependency on s.el
branch: elpa/dockerfile-mode commit 6a56c1cc1713b501040b08fdbf0c4159a4fe95f9 Author: Phil Sainty Commit: Drew Csillag Remove dependency on s.el --- dockerfile-mode.el | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/dockerfile-mode.el b/dockerfile-mode.el index 6d9afa27ef..d80a936f1a 100644 --- a/dockerfile-mode.el +++ b/dockerfile-mode.el @@ -1,7 +1,7 @@ ;;; dockerfile-mode.el --- Major mode for editing Docker's Dockerfiles -*- lexical-binding: t -*- ;; Copyright (c) 2013 Spotify AB -;; Package-Requires: ((emacs "24") (s "1.12")) +;; Package-Requires: ((emacs "24")) ;; Homepage: https://github.com/spotify/dockerfile-mode ;; ;; Licensed under the Apache License, Version 2.0 (the "License"); you may not @@ -26,7 +26,6 @@ (require 'sh-script) (require 'rx) -(require 's) (declare-function cygwin-convert-file-name-to-windows "cygw32.c" (file &optional absolute-p)) @@ -144,7 +143,8 @@ indented by one `tab-width'." If in Cygwin environment, uses Cygwin specific function to convert the file name. Otherwise, uses Emacs' standard conversion function." (if (fboundp 'cygwin-convert-file-name-to-windows) - (s-replace "\\" "" (cygwin-convert-file-name-to-windows file)) + (replace-regexp-in-string + (rx "\\") "" (cygwin-convert-file-name-to-windows file) t t) (convert-standard-filename file))) (defun dockerfile-tag-string (image-name)
[nongnu] elpa/dockerfile-mode 8172d83d5d 076/104: Merge pull request #40 from abloomston/safe-local-variable
branch: elpa/dockerfile-mode commit 8172d83d5d49f411f8b034ab27e459b853622b15 Merge: 818e6946fc 6e1bf5dea4 Author: Drew Csillag Commit: GitHub Merge pull request #40 from abloomston/safe-local-variable README.md addition for safe-local-variable --- README.md | 5 + 1 file changed, 5 insertions(+) diff --git a/README.md b/README.md index 9d94a4e909..88e40ecb8a 100644 --- a/README.md +++ b/README.md @@ -23,3 +23,8 @@ at the top of your Dockerfile. ``` If you don't, you'll be prompted for an image name each time you build. +You may want to add the following to your emacs config: + +``` emacs-lisp +(put 'dockerfile-image-name 'safe-local-variable #'stringp) +```
[nongnu] elpa/dockerfile-mode fadac401c8 019/104: added note about emacs compatibility
branch: elpa/dockerfile-mode commit fadac401c83ce792fde2a74c016b3dfb2b92d2c4 Author: Andy Csillag Commit: Andy Csillag added note about emacs compatibility --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 52db15d50c..c3c7fb8501 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,6 @@ dockerfile-mode === +Known to work with Emacs 24 and later A Dockerfile mode for emacs @@ -15,4 +16,4 @@ at the top of your Dockerfile. ## -*- docker-image-name: "your-image-name-here" -*- -If you don't, you'll be prompted for an image name each time you build. \ No newline at end of file +If you don't, you'll be prompted for an image name each time you build.
[nongnu] elpa/dockerfile-mode b01f2ecdb6 094/104: Merge branch 'ncaq-add-dockerfile-indent-offset'
branch: elpa/dockerfile-mode commit b01f2ecdb6ce981e07e5caa4ec712904071ea26a Merge: 27a9f4d2f3 33bd07b9b2 Author: Drew Csillag Commit: Drew Csillag Merge branch 'ncaq-add-dockerfile-indent-offset' --- dockerfile-mode.el | 11 --- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/dockerfile-mode.el b/dockerfile-mode.el index ffa79d5f4b..2e32e0f4cd 100644 --- a/dockerfile-mode.el +++ b/dockerfile-mode.el @@ -65,7 +65,12 @@ Each element of the list will be passed as a separate This is the new buildsystem for docker, and in time it will replace the old one but for now it has to be explicitly enabled to work. It is supported from docker 18.09" - :type 'boolean + :type 'boolean) + +(defcustom dockerfile-indent-offset (or standard-indent 2) + "Dockerfile number of columns for margin-changing functions to indent." + :type 'integer + :safe #'integerp :group 'dockerfile) (defface dockerfile-image-name @@ -131,7 +136,7 @@ It is supported from docker 18.09" "Indent lines in a Dockerfile. Lines beginning with a keyword are ignored, and any others are -indented by one `tab-width'." +indented by one `dockerfile-indent-offset'." (unless (member (get-text-property (point-at-bol) 'face) '(font-lock-comment-delimiter-face font-lock-keyword-face)) (save-excursion @@ -140,7 +145,7 @@ indented by one `tab-width'." (unless (equal (point) (point-at-eol)) ; Ignore empty lines. ;; Delete existing whitespace. (delete-char (- (point-at-bol) (point))) -(indent-to tab-width) +(indent-to dockerfile-indent-offset) (defun dockerfile-build-arg-string () "Create a --build-arg string for each element in `dockerfile-build-args'."
[nongnu] elpa/dockerfile-mode 64733f64ea 077/104: Merge pull request #41 from Fuco1/feature/image-name-font-lock
branch: elpa/dockerfile-mode commit 64733f64ea9be1e5e534e590846869b75c62ed1f Merge: 8172d83d5d 902e4c2a5a Author: Drew Csillag Commit: GitHub Merge pull request #41 from Fuco1/feature/image-name-font-lock Add faces for image name and alias --- dockerfile-mode.el | 11 +++ 1 file changed, 11 insertions(+) diff --git a/dockerfile-mode.el b/dockerfile-mode.el index f031ff20be..9c9933a8b2 100644 --- a/dockerfile-mode.el +++ b/dockerfile-mode.el @@ -55,6 +55,14 @@ Each element of the list will be passed as a separate :type '(repeat string) :group 'dockerfile) +(defface dockerfile-image-name + '((t (:inherit (font-lock-type-face bold + "Face to highlight the base image name after FROM instruction.") + +(defface dockerfile-image-alias + '((t (:inherit (font-lock-constant-face bold + "Face to highlight the base image alias inf FROM ... AS construct.") + (defvar dockerfile-font-lock-keywords `(,(cons (rx (or line-start "onbuild ") (group (or "from" "maintainer" "run" "cmd" "expose" "env" "arg" @@ -62,6 +70,9 @@ Each element of the list will be passed as a separate "label" "stopsignal" "shell" "healthcheck")) word-boundary) font-lock-keyword-face) +(,(rx "FROM " (group (+? nonl)) (or " " eol) (? "as " (group (1+ nonl + (1 'dockerfile-image-name) + (2 'dockerfile-image-alias nil t)) ,@(sh-font-lock-keywords) ,@(sh-font-lock-keywords-2) ,@(sh-font-lock-keywords-1))
[nongnu] elpa/dockerfile-mode 88efae4e78 033/104: dockerfile-mode.el: add LABEL to the list of known keywords
branch: elpa/dockerfile-mode commit 88efae4e78e4f2a940cda3d0ee1c2fc473bf1a6a Author: Giuseppe Scrivano Commit: Giuseppe Scrivano dockerfile-mode.el: add LABEL to the list of known keywords LABELs are used extensively in Red Hat Dockerfiles, give them some colors. Signed-off-by: Giuseppe Scrivano --- dockerfile-mode.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dockerfile-mode.el b/dockerfile-mode.el index 8c6509e909..e4f072b559 100644 --- a/dockerfile-mode.el +++ b/dockerfile-mode.el @@ -38,7 +38,8 @@ (defvar dockerfile-font-lock-keywords `(,(cons (rx (or line-start "onbuild ") (group (or "from" "maintainer" "run" "cmd" "expose" "env" - "add" "copy" "entrypoint" "volume" "user" "workdir" "onbuild")) + "add" "copy" "entrypoint" "volume" "user" "workdir" "onbuild" + "label")) word-boundary) font-lock-keyword-face) ,@(sh-font-lock-keywords)
[nongnu] elpa/dockerfile-mode 9f4381178a 079/104: Adds a very simple indent-line-function for Dockerfiles.
branch: elpa/dockerfile-mode commit 9f4381178aa03212cd3400c60c0f48ff306a0994 Author: Aaron Jacobs Commit: Drew Csillag Adds a very simple indent-line-function for Dockerfiles. Signed-off-by: Aaron Jacobs --- dockerfile-mode.el | 18 +- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/dockerfile-mode.el b/dockerfile-mode.el index d55fe7b73b..ca2d19823d 100644 --- a/dockerfile-mode.el +++ b/dockerfile-mode.el @@ -115,6 +115,21 @@ Each element of the list will be passed as a separate (unless dockerfile-mode-abbrev-table (define-abbrev-table 'dockerfile-mode-abbrev-table ())) +(defun dockerfile-indent-line-function () + "Indent lines in a Dockerfile. + +Lines beginning with a keyword are ignored, and any others are +indented by one `tab-width'." + (unless (eq (get-text-property (point-at-bol) 'face) + 'font-lock-keyword-face) +(save-excursion + (beginning-of-line) + (skip-chars-forward "[ \t]" (point-at-eol)) + (unless (equal (point) (point-at-eol)) ; Ignore empty lines. +;; Delete existing whitespace. +(delete-char (- (point-at-bol) (point))) +(indent-to tab-width) + (defun dockerfile-build-arg-string () "Create a --build-arg string for each element in `dockerfile-build-args'." (mapconcat (lambda (arg) (concat "--build-arg " (shell-quote-argument arg))) @@ -196,7 +211,8 @@ returned, otherwise the base image name is used." (set (make-local-variable 'parse-sexp-ignore-comments) t) (set (make-local-variable 'font-lock-defaults) '(dockerfile-font-lock-keywords nil t)) - (setq local-abbrev-table dockerfile-mode-abbrev-table)) + (setq local-abbrev-table dockerfile-mode-abbrev-table) + (setq indent-line-function #'dockerfile-indent-line-function)) ;;;###autoload (add-to-list 'auto-mode-alist '("Dockerfile\\(?:\\..*\\)?\\'" . dockerfile-mode))
[nongnu] elpa/dockerfile-mode 9a75fcd119 034/104: Merge pull request #19 from giuseppe/giuseppe/color-label
branch: elpa/dockerfile-mode commit 9a75fcd119c5b2a1d723d440bbe4b1db56df90cc Merge: cfa634ff1d 88efae4e78 Author: Drew Csillag Commit: Drew Csillag Merge pull request #19 from giuseppe/giuseppe/color-label dockerfile-mode.el: add LABEL to the list of known keywords --- dockerfile-mode.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dockerfile-mode.el b/dockerfile-mode.el index 8c6509e909..e4f072b559 100644 --- a/dockerfile-mode.el +++ b/dockerfile-mode.el @@ -38,7 +38,8 @@ (defvar dockerfile-font-lock-keywords `(,(cons (rx (or line-start "onbuild ") (group (or "from" "maintainer" "run" "cmd" "expose" "env" - "add" "copy" "entrypoint" "volume" "user" "workdir" "onbuild")) + "add" "copy" "entrypoint" "volume" "user" "workdir" "onbuild" + "label")) word-boundary) font-lock-keyword-face) ,@(sh-font-lock-keywords)
[nongnu] elpa/dockerfile-mode 533d5d4983 096/104: Tighten auto-mode-alist pattern some more
branch: elpa/dockerfile-mode commit 533d5d4983a6f8c21f8d2391cabe60282cd8dd7a Author: Lassi Kortela Commit: Drew Csillag Tighten auto-mode-alist pattern some more "/Dockerfile.foo/bar" should not match. To ensure we're looking at the last pathname component, don't match slashes or backslashes. --- dockerfile-mode.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dockerfile-mode.el b/dockerfile-mode.el index 17628d45e7..f5c4202ac7 100644 --- a/dockerfile-mode.el +++ b/dockerfile-mode.el @@ -241,7 +241,8 @@ returned, otherwise the base image name is used." (set (make-local-variable 'indent-line-function) #'dockerfile-indent-line-function)) ;;;###autoload -(add-to-list 'auto-mode-alist '("/Dockerfile\\(?:\\..*\\)?\\'" . dockerfile-mode)) +(add-to-list 'auto-mode-alist '("/Dockerfile\\(?:\\.[^/\\]*\\)?\\'" . +dockerfile-mode)) ;;;###autoload (add-to-list 'auto-mode-alist '("\\.dockerfile\\'" . dockerfile-mode))
[nongnu] elpa/dockerfile-mode fd1cf02f06 040/104: Merge pull request #22 from jaccarmac/fix-windows-build
branch: elpa/dockerfile-mode commit fd1cf02f06a525e7582a11d942df1c9269716b10 Merge: 6fcecb517d 35d10860d9 Author: Drew Csillag Commit: Drew Csillag Merge pull request #22 from jaccarmac/fix-windows-build Fix inability to build images on Windows. --- dockerfile-mode.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dockerfile-mode.el b/dockerfile-mode.el index b992b81957..c83820e11e 100644 --- a/dockerfile-mode.el +++ b/dockerfile-mode.el @@ -90,7 +90,7 @@ (save-buffer) (if (stringp image-name) (async-shell-command - (format "%s docker build -t %s -f \"%s\" \"%s\"" (if dockerfile-use-sudo "sudo" "") image-name (buffer-file-name) (file-name-directory (buffer-file-name))) + (format "%sdocker build -t %s -f \"%s\" \"%s\"" (if dockerfile-use-sudo "sudo " "") image-name (buffer-file-name) (file-name-directory (buffer-file-name))) "*docker-build-output*") (print "docker-image-name must be a string, consider surrounding it with double quotes")))
[nongnu] elpa/dockerfile-mode a4f8aad581 091/104: FIX: make emacs lisp variable name consistent in README.md
branch: elpa/dockerfile-mode commit a4f8aad58109e8aa3fb39055ffe23cd5124a8fb8 Author: marketneutral Commit: Drew Csillag FIX: make emacs lisp variable name consistent in README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 9785a058fe..221fcad178 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,7 @@ If you don't, you'll be prompted for an image name each time you build. You may want to add the following to your emacs config: ``` emacs-lisp -(put 'dockerfile-image-name 'safe-local-variable #'stringp) +(put 'docker-image-name 'safe-local-variable #'stringp) ``` You can change the binary to use with
[nongnu] elpa/dockerfile-mode fd8057e438 098/104: Fix elisp byte-compiler warning
branch: elpa/dockerfile-mode commit fd8057e4383263e6ed2a5049e7ae8583f1aac43f Author: Lassi Kortela Commit: Drew Csillag Fix elisp byte-compiler warning --- dockerfile-mode.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dockerfile-mode.el b/dockerfile-mode.el index 737fa63002..8d4736c0bc 100644 --- a/dockerfile-mode.el +++ b/dockerfile-mode.el @@ -165,10 +165,11 @@ file name. Otherwise, uses Emacs' standard conversion function." "Return a --tag shell-quoted IMAGE-NAME string or an empty string if image-name is blank." (if (string= image-name "") "" (format "--tag %s " (shell-quote-argument image-name +(define-obsolete-variable-alias 'docker-image-name 'dockerfile-image-name "2017-10-22") + (defvar dockerfile-image-name nil "Name of the dockerfile currently being used. This can be set in file or directory-local variables.") -(define-obsolete-variable-alias 'docker-image-name 'dockerfile-image-name "2017-10-22") (defvar dockerfile-image-name-history nil "History of image names read by `dockerfile-read-image-name'.")
[nongnu] elpa/dockerfile-mode 83bc055f5b 103/104: Readme: Replace obsolete variable name with current
branch: elpa/dockerfile-mode commit 83bc055f5bcafabd3a10655a193fe8fe8b886867 Author: Alfonso Montero Commit: Drew Csillag Readme: Replace obsolete variable name with current --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 221fcad178..880211074b 100644 --- a/README.md +++ b/README.md @@ -19,14 +19,14 @@ You can specify the image name in the file itself by adding a line like this at the top of your Dockerfile. ``` emacs-lisp -## -*- docker-image-name: "your-image-name-here" -*- +## -*- dockerfile-image-name: "your-image-name-here" -*- ``` If you don't, you'll be prompted for an image name each time you build. You may want to add the following to your emacs config: ``` emacs-lisp -(put 'docker-image-name 'safe-local-variable #'stringp) +(put 'dockerfile-image-name 'safe-local-variable #'stringp) ``` You can change the binary to use with
[nongnu] elpa/dockerfile-mode ad06a41259 101/104: Remove unnecessary declaration of dockerfile-mode-hook
branch: elpa/dockerfile-mode commit ad06a41259ff2961d603bf23a3a8fbd22dde2161 Author: Brian Leung Commit: Drew Csillag Remove unnecessary declaration of dockerfile-mode-hook The invocation of define-derived-mode defines the hook. --- dockerfile-mode.el | 5 - 1 file changed, 5 deletions(-) diff --git a/dockerfile-mode.el b/dockerfile-mode.el index 3551212eb3..05d39689c4 100644 --- a/dockerfile-mode.el +++ b/dockerfile-mode.el @@ -36,11 +36,6 @@ :prefix "dockerfile-" :group 'languages) -(defcustom dockerfile-mode-hook nil - "*Hook called by `dockerfile-mode'." - :type 'hook - :group 'dockerfile) - (defcustom dockerfile-mode-command "docker" "Which binary to use to build images." :group 'dockerfile
[nongnu] elpa/dockerfile-mode 8273401efa 045/104: Merge pull request #26 from rcj/master
branch: elpa/dockerfile-mode commit 8273401efac2b51fc7381cf1564d016ad7467ce1 Merge: 53434afa3b fdebd1eda5 Author: Drew Csillag Commit: GitHub Merge pull request #26 from rcj/master Pass --build-args to docker build --- dockerfile-mode.el | 17 +++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/dockerfile-mode.el b/dockerfile-mode.el index b14eae99b8..bbdae27737 100644 --- a/dockerfile-mode.el +++ b/dockerfile-mode.el @@ -35,6 +35,14 @@ (defcustom dockerfile-use-sudo nil "Runs docker builder command with sudo.") +(defcustom dockerfile-build-args nil + "List of --build-arg to pass to docker build. + +Each element of the list will be passed as a separate + --build-arg to the docker build command." + :type '(repeat string) + :group 'dockerfile) + (defvar dockerfile-font-lock-keywords `(,(cons (rx (or line-start "onbuild ") (group (or "from" "maintainer" "run" "cmd" "expose" "env" "arg" @@ -80,6 +88,11 @@ (unless dockerfile-mode-abbrev-table (define-abbrev-table 'dockerfile-mode-abbrev-table ())) +(defun dockerfile-build-arg-string () + "Create a --build-arg string for each element in `dockerfile-build-args'." + (mapconcat (lambda (arg) (concat "--build-arg " "\"" arg "\"")) + dockerfile-build-args " ")) + ;;;###autoload (defun dockerfile-build-buffer (image-name) "Build an image based upon the buffer" @@ -90,7 +103,7 @@ (save-buffer) (if (stringp image-name) (async-shell-command - (format "%sdocker build -t %s -f \"%s\" \"%s\"" (if dockerfile-use-sudo "sudo " "") image-name (buffer-file-name) (file-name-directory (buffer-file-name))) + (format "%sdocker build -t %s %s -f \"%s\" \"%s\"" (if dockerfile-use-sudo "sudo " "") image-name (dockerfile-build-arg-string) (buffer-file-name) (file-name-directory (buffer-file-name))) "*docker-build-output*") (print "docker-image-name must be a string, consider surrounding it with double quotes"))) @@ -104,7 +117,7 @@ (save-buffer) (if (stringp image-name) (async-shell-command - (format "%s docker build --no-cache -t %s -f \"%s\" \"%s\"" (if dockerfile-use-sudo "sudo" "") image-name (buffer-file-name) (file-name-directory (buffer-file-name))) + (format "%s docker build --no-cache -t %s %s -f \"%s\" \"%s\"" (if dockerfile-use-sudo "sudo" "") image-name (dockerfile-build-arg-string) (buffer-file-name) (file-name-directory (buffer-file-name))) "*docker-build-output*") (print "docker-image-name must be a string, consider surrounding it with double quotes")))
[nongnu] elpa/dockerfile-mode a690935648 055/104: Make no attempt to support antiquated Emacsen < 24
branch: elpa/dockerfile-mode commit a690935648df49cda0cbd2b6e88d25cbd620752e Author: Steve Purcell Commit: Steve Purcell Make no attempt to support antiquated Emacsen < 24 --- dockerfile-mode.el | 7 ++- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/dockerfile-mode.el b/dockerfile-mode.el index 2c30a465f6..678be1a14c 100644 --- a/dockerfile-mode.el +++ b/dockerfile-mode.el @@ -1,6 +1,7 @@ ;;; dockerfile-mode.el --- Major mode for editing Docker's Dockerfiles ;; Copyright (c) 2013 Spotify AB +;; Package-Requires: ((emacs "24")) ;; ;; Licensed under the Apache License, Version 2.0 (the "License"); you may not ;; use this file except in compliance with the License. You may obtain a copy of @@ -142,12 +143,8 @@ file name. Otherwise, uses Emacs' standard conversion function." "*docker-build-output*") (print "docker-image-name must be a string, consider surrounding it with double quotes"))) -;; Handle emacs < 24, which does not have prog-mode -(defalias 'dockerfile-parent-mode - (if (fboundp 'prog-mode) 'prog-mode 'fundamental-mode)) - ;;;###autoload -(define-derived-mode dockerfile-mode dockerfile-parent-mode "Dockerfile" +(define-derived-mode dockerfile-mode prog-mode "Dockerfile" "A major mode to edit Dockerfiles. \\{dockerfile-mode-map} "
[nongnu] elpa/dockerfile-mode fb7bb1e444 020/104: Add support for custom Dockerfiles
branch: elpa/dockerfile-mode commit fb7bb1e4445618d48a513efe257f3d27fbef1c49 Author: Philippe Vaucher Commit: Philippe Vaucher Add support for custom Dockerfiles --- dockerfile-mode.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dockerfile-mode.el b/dockerfile-mode.el index 468d2f6edc..ff01bff055 100644 --- a/dockerfile-mode.el +++ b/dockerfile-mode.el @@ -83,7 +83,7 @@ (save-buffer) (if (stringp image-name) (shell-command - (concat (if dockerfile-use-sudo "sudo " "") "docker build -t " image-name " " (file-name-directory (buffer-file-name)) "&") + (concat (if dockerfile-use-sudo "sudo " "") "docker build -t " image-name " -f " (buffer-file-name) " " (file-name-directory (buffer-file-name)) "&") "*docker-build-output*") (print "docker-image-name must be a string, consider surrounding it with double quotes"))) @@ -107,7 +107,7 @@ (setq local-abbrev-table dockerfile-mode-abbrev-table)) ;;;###autoload -(add-to-list 'auto-mode-alist '("Dockerfile\\'" . dockerfile-mode)) +(add-to-list 'auto-mode-alist '("Dockerfile.*\\'" . dockerfile-mode)) (provide 'dockerfile-mode)
[nongnu] elpa/dockerfile-mode 3b1374563f 100/104: Add support for TRAMP file names
branch: elpa/dockerfile-mode commit 3b1374563f62d71aec11ebd33d37109459e54571 Author: Juergen Hoetzel Commit: Drew Csillag Add support for TRAMP file names Use localname component of the remote file name: Fixes #55 --- dockerfile-mode.el | 8 ++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/dockerfile-mode.el b/dockerfile-mode.el index 8d4736c0bc..3551212eb3 100644 --- a/dockerfile-mode.el +++ b/dockerfile-mode.el @@ -198,8 +198,12 @@ The build string will be of the format: (if no-cache "--no-cache" "") (dockerfile-tag-string image-name) (dockerfile-build-arg-string) -(shell-quote-argument (dockerfile-standard-filename (buffer-file-name))) -(shell-quote-argument (dockerfile-standard-filename default-directory))) +(shell-quote-argument (dockerfile-standard-filename + (or (file-remote-p (buffer-file-name) 'localname) + (buffer-file-name +(shell-quote-argument (dockerfile-standard-filename + (or (file-remote-p default-directory 'localname) + default-directory nil (lambda (_) (format "*docker-build-output: %s *" image-name
[nongnu] elpa/dockerfile-mode 6b60974e74 027/104: Add autoload marker for `dockerfile-build-buffer`
branch: elpa/dockerfile-mode commit 6b60974e742c4dfa6068cd6d61a709971b28daa0 Author: Philippe Vaucher Commit: Philippe Vaucher Add autoload marker for `dockerfile-build-buffer` --- dockerfile-mode.el | 1 + 1 file changed, 1 insertion(+) diff --git a/dockerfile-mode.el b/dockerfile-mode.el index a15f5b8473..1d16ebcae8 100644 --- a/dockerfile-mode.el +++ b/dockerfile-mode.el @@ -74,6 +74,7 @@ (unless dockerfile-mode-abbrev-table (define-abbrev-table 'dockerfile-mode-abbrev-table ())) +;;;###autoload (defun dockerfile-build-buffer (image-name) "Build an image based upon the buffer" (interactive
[nongnu] elpa/dockerfile-mode 628315e2e4 102/104: Added version and URL header
branch: elpa/dockerfile-mode commit 628315e2e4ab2f269548126444234caa057b2c75 Author: Drew Csillag Commit: Drew Csillag Added version and URL header --- dockerfile-mode.el | 3 +++ 1 file changed, 3 insertions(+) diff --git a/dockerfile-mode.el b/dockerfile-mode.el index 05d39689c4..8c12ac45b8 100644 --- a/dockerfile-mode.el +++ b/dockerfile-mode.el @@ -3,6 +3,9 @@ ;; Copyright (c) 2013 Spotify AB ;; Package-Requires: ((emacs "24")) ;; Homepage: https://github.com/spotify/dockerfile-mode +;; URL: https://github.com/spotify/dockerfile-mode +;; Version: 1.5 +;; Keywords: docker ;; ;; Licensed under the Apache License, Version 2.0 (the "License"); you may not ;; use this file except in compliance with the License. You may obtain a copy of
[nongnu] elpa/dockerfile-mode b53020b781 065/104: Add custom `dockerfile-use-sudo` type and group
branch: elpa/dockerfile-mode commit b53020b7818973ec56654b5897aaf969e0c0ca83 Author: Guillermo Robles Commit: Guillermo Robles Add custom `dockerfile-use-sudo` type and group --- dockerfile-mode.el | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/dockerfile-mode.el b/dockerfile-mode.el index ca131af588..0cd9625605 100644 --- a/dockerfile-mode.el +++ b/dockerfile-mode.el @@ -43,7 +43,9 @@ :group 'dockerfile) (defcustom dockerfile-use-sudo nil - "Runs docker builder command with sudo.") + "Runs docker builder command with sudo." + :type 'boolean + :group 'dockerfile) (defcustom dockerfile-build-args nil "List of --build-arg to pass to docker build.
[nongnu] elpa/dockerfile-mode e6d5598bf0 068/104: Add adequate spacing to documentation
branch: elpa/dockerfile-mode commit e6d5598bf0eb1de264fc2787a0ed0f9968d84d8a Author: Guillermo Robles Commit: Guillermo Robles Add adequate spacing to documentation --- dockerfile-mode.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dockerfile-mode.el b/dockerfile-mode.el index 6975f7c68a..c011eef96a 100644 --- a/dockerfile-mode.el +++ b/dockerfile-mode.el @@ -109,7 +109,7 @@ Each element of the list will be passed as a separate (defun dockerfile-standard-filename (file) "Convert the FILE name to OS standard. If in Cygwin environment, uses Cygwin specific function to convert the -file name. Otherwise, uses Emacs' standard conversion function." +file name. Otherwise, uses Emacs' standard conversion function." (if (fboundp 'cygwin-convert-file-name-to-windows) (s-replace "\\" "" (cygwin-convert-file-name-to-windows file)) (convert-standard-filename file)))
[nongnu] elpa/dockerfile-mode 95f55f3697 031/104: add dockerfile-build-no-cache-buffer
branch: elpa/dockerfile-mode commit 95f55f3697e562cbf43ff31e59ac8dd925211d53 Author: nabeo Commit: nabeo add dockerfile-build-no-cache-buffer --- dockerfile-mode.el | 18 ++ 1 file changed, 18 insertions(+) diff --git a/dockerfile-mode.el b/dockerfile-mode.el index c3bc7fffa4..8c6509e909 100644 --- a/dockerfile-mode.el +++ b/dockerfile-mode.el @@ -50,6 +50,7 @@ (let ((map (make-sparse-keymap)) (menu-map (make-sparse-keymap))) (define-key map "\C-c\C-b" 'dockerfile-build-buffer) +(define-key map "\C-c\M-b" 'dockerfile-build-no-cache-buffer) (define-key map "\C-c\C-z" 'dockerfile-test-function) (define-key map "\C-c\C-c" 'comment-region) (define-key map [menu-bar dockerfile-mode] (cons "Dockerfile" menu-map)) @@ -59,6 +60,9 @@ (define-key menu-map [dfb] '(menu-item "Build" dockerfile-build-buffer :help "Send the Dockerfile to docker build")) +(define-key menu-map [dfb] + '(menu-item "Build without cache" dockerfile-build-no-cache-buffer + :help "Send the Dockerfile to docker build without cache")) map)) (defvar dockerfile-mode-syntax-table @@ -89,6 +93,20 @@ "*docker-build-output*") (print "docker-image-name must be a string, consider surrounding it with double quotes"))) +;;;###autoload +(defun dockerfile-build-no-cache-buffer (image-name) + "Build an image based upon the buffer without cache" + (interactive + (if (null docker-image-name) + (list (read-string "image-name: " nil nil)) + (list docker-image-name))) + (save-buffer) + (if (stringp image-name) + (async-shell-command + (format "%s docker build --no-cache -t %s -f %s %s" (if dockerfile-use-sudo "sudo" "") image-name (buffer-file-name) (file-name-directory (buffer-file-name))) + "*docker-build-output*") +(print "docker-image-name must be a string, consider surrounding it with double quotes"))) + ;; Handle emacs < 24, which does not have prog-mode (defalias 'dockerfile-parent-mode (if (fboundp 'prog-mode) 'prog-mode 'fundamental-mode))