(let ((shadows (shadow-shadows-of
(shadow-expand-file-name
(buffer-file-name (current-buffer))))))
+ (when shadow-debug
+ (message
+ "shadow-add-to-todo: %s %s\n%s"
+ shadows shadow-files-to-copy (with-output-to-string (backtrace))))
(when shadows
(setq shadow-files-to-copy
(shadow-union shadows shadow-files-to-copy))
(defun shadow-remove-from-todo (pair)
"Remove PAIR from `shadow-files-to-copy'.
PAIR must be `eq' to one of the elements of that list."
+ (when shadow-debug
+ (message
+ "shadow-remove-from-todo: %s %s\n%s"
+ pair shadow-files-to-copy (with-output-to-string (backtrace))))
(setq shadow-files-to-copy
(cl-remove-if (lambda (s) (eq s pair)) shadow-files-to-copy)))
(if save (shadow-save-todo-file))))
(defun shadow-save-todo-file ()
+ (when shadow-debug
+ (message "shadow-save-todo-file:\n%s" (with-output-to-string (backtrace))))
(if (and shadow-todo-buffer (buffer-modified-p shadow-todo-buffer))
(with-current-buffer shadow-todo-buffer
(condition-case nil ; have to continue even in case of
(buffer-list))))
(yes-or-no-p "Modified buffers exist; exit anyway? "))
(or (not (fboundp 'process-list))
- ;; process-list is not defined on MSDOS.
+ ;; `process-list' is not defined on MSDOS.
(let ((processes (process-list))
active)
(while processes
(unwind-protect
;; We must mock `read-from-minibuffer' and `read-string', in
;; order to avoid interactive arguments.
- (cl-letf* (((symbol-function 'read-from-minibuffer)
+ (cl-letf* (((symbol-function #'read-from-minibuffer)
(lambda (&rest args) (pop mocked-input)))
- ((symbol-function 'read-string)
+ ((symbol-function #'read-string)
(lambda (&rest args) (pop mocked-input))))
;; Cleanup & initialize.
primary shadow-system-name
regexp (shadow-regexp-superquote primary)
mocked-input `(,cluster ,primary ,regexp))
- (call-interactively 'shadow-define-cluster)
+ (call-interactively #'shadow-define-cluster)
(should
(string-equal
(shadow-cluster-name (shadow-get-cluster cluster)) cluster))
mocked-input `(,cluster ,cluster ,primary ,regexp))
(with-current-buffer (messages-buffer)
(narrow-to-region (point-max) (point-max)))
- (call-interactively 'shadow-define-cluster)
+ (call-interactively #'shadow-define-cluster)
(should
(string-match
(regexp-quote "Not a valid primary!")
mocked-input `(,cluster ,primary ,cluster ,regexp))
(with-current-buffer (messages-buffer)
(narrow-to-region (point-max) (point-max)))
- (call-interactively 'shadow-define-cluster)
+ (call-interactively #'shadow-define-cluster)
(should
(string-match
(regexp-quote "Regexp doesn't include the primary host!")
(file-remote-p shadow-test-remote-temporary-file-directory)
regexp (shadow-regexp-superquote primary)
mocked-input `(,cluster ,primary ,regexp))
- (call-interactively 'shadow-define-cluster)
+ (call-interactively #'shadow-define-cluster)
(should
(string-equal
(shadow-cluster-name (shadow-get-cluster cluster)) cluster))
(unwind-protect
;; We must mock `read-from-minibuffer' and `read-string', in
;; order to avoid interactive arguments.
- (cl-letf* (((symbol-function 'read-from-minibuffer)
+ (cl-letf* (((symbol-function #'read-from-minibuffer)
(lambda (&rest args) (pop mocked-input)))
- ((symbol-function 'read-string)
+ ((symbol-function #'read-string)
(lambda (&rest args) (pop mocked-input))))
;; Cleanup & initialize.
(unwind-protect
;; We must mock `read-from-minibuffer' and `read-string', in
;; order to avoid interactive arguments.
- (cl-letf* (((symbol-function 'read-from-minibuffer)
+ (cl-letf* (((symbol-function #'read-from-minibuffer)
(lambda (&rest args) (pop mocked-input)))
- ((symbol-function 'read-string)
+ ((symbol-function #'read-string)
(lambda (&rest args) (pop mocked-input))))
;; Cleanup & initialize.
mocked-input `(,cluster1 ,file1 ,cluster2 ,file2 ,(kbd "RET")))
(with-temp-buffer
(set-visited-file-name file1)
- (call-interactively 'shadow-define-literal-group)
+ (call-interactively #'shadow-define-literal-group)
(set-buffer-modified-p nil))
;; `shadow-literal-groups' is a list of lists.
(unwind-protect
;; We must mock `read-from-minibuffer' and `read-string', in
;; order to avoid interactive arguments.
- (cl-letf* (((symbol-function 'read-from-minibuffer)
+ (cl-letf* (((symbol-function #'read-from-minibuffer)
(lambda (&rest args) (pop mocked-input)))
- ((symbol-function 'read-string)
+ ((symbol-function #'read-string)
(lambda (&rest args) (pop mocked-input))))
;; Cleanup & initialize.
,cluster1 ,cluster2 ,(kbd "RET")))
(with-temp-buffer
(set-visited-file-name nil)
- (call-interactively 'shadow-define-regexp-group))
+ (call-interactively #'shadow-define-regexp-group)
+ (set-buffer-modified-p nil))
;; `shadow-regexp-groups' is a list of lists.
(should (consp shadow-regexp-groups))
regexp (shadow-regexp-superquote primary))
(shadow-set-cluster cluster1 primary regexp)
(when shadow-debug
- (message "%s %s %s %s" cluster1 primary regexp shadow-clusters))
+ (message
+ "shadow-test08-shadow-todo: %s %s %s %s"
+ cluster1 primary regexp shadow-clusters))
(setq cluster2 "cluster2"
primary
regexp (shadow-regexp-superquote primary))
(shadow-set-cluster cluster2 primary regexp)
(when shadow-debug
- (message "%s %s %s %s" cluster2 primary regexp shadow-clusters))
+ (message
+ "shadow-test08-shadow-todo: %s %s %s %s"
+ cluster2 primary regexp shadow-clusters))
;; Define a literal group.
(setq file
shadow-literal-groups
`((,(concat "/cluster1:" file) ,(concat "/cluster2:" file))))
(when shadow-debug
- (message "%s %s" file shadow-literal-groups))
+ (message
+ "shadow-test08-shadow-todo: %s %s" file shadow-literal-groups))
;; Save file from "cluster1" definition.
(with-temp-buffer
(save-buffer))
(when shadow-debug
(message
- "%s %s"
+ "shadow-test08-shadow-todo: %s %s"
(cons file (shadow-contract-file-name (concat "/cluster2:" file)))
shadow-files-to-copy))
(should
(save-buffer))
(when shadow-debug
(message
- "%s %s"
+ "shadow-test08-shadow-todo: %s %s"
(cons
(concat (shadow-site-primary cluster2) file)
(shadow-contract-file-name (concat "/cluster1:" file)))
,(concat (shadow-site-primary cluster2)
(shadow-regexp-superquote file)))))
(when shadow-debug
- (message "%s %s" file shadow-regexp-groups))
+ (message
+ "shadow-test08-shadow-todo: %s %s" file shadow-regexp-groups))
;; Save file from "cluster1" definition.
(with-temp-buffer
(save-buffer))
(when shadow-debug
(message
- "%s %s"
+ "shadow-test08-shadow-todo: %s %s"
(cons file (shadow-contract-file-name (concat "/cluster2:" file)))
shadow-files-to-copy))
(should
(save-buffer))
(when shadow-debug
(message
- "%s %s"
+ "shadow-test08-shadow-todo: %s %s"
(cons
(concat (shadow-site-primary cluster2) file)
(shadow-contract-file-name (concat "/cluster1:" file)))
;; We must mock `write-region', in order to check proper
;; action.
(add-function
- :before (symbol-function 'write-region)
+ :before (symbol-function #'write-region)
(lambda (&rest args)
(when (and (buffer-file-name) mocked-input)
(should (equal (buffer-file-name) (pop mocked-input)))))
(looking-at (regexp-quote "(setq shadow-files-to-copy nil)")))))
;; Cleanup.
- (remove-function (symbol-function 'write-region) "write-region-mock")
+ (remove-function (symbol-function #'write-region) "write-region-mock")
(dolist (elt `(,file ,(concat (shadow-site-primary cluster2) file)))
(ignore-errors
(with-current-buffer (get-file-buffer elt)