File tree 4 files changed +14
-13
lines changed
4 files changed +14
-13
lines changed Original file line number Diff line number Diff line change 11
11
(defconst syncthing-day-seconds (* 1 60 60 24 ))
12
12
(defconst syncthing-hour-seconds (* 1 60 60 ))
13
13
(defconst syncthing-min-seconds (* 1 60 ))
14
+ (defconst syncthing-msg-cant-edit-buffer
15
+ " You can not edit this part of the Syncthing buffer" )
14
16
15
17
; ; Docstrings from Syncthing (MPL-2.0)
16
18
; ; https://www.fsf.org/blogs/licensing/mpl-2.0-release
Original file line number Diff line number Diff line change 7
7
8
8
(define-error 'syncthing-error " Generic syncthing error" )
9
9
10
- (define-error 'syncthing-error-cant-edit-buffer
11
- " You can not edit this part of the Syncthing buffer"
12
- 'syncthing-error )
13
-
14
10
(define-error 'syncthing-error-cant-authenticate
15
11
" Failed to authenticate, check the token!"
16
12
'syncthing-error )
Original file line number Diff line number Diff line change 9
9
(require 'widget )
10
10
11
11
(require 'syncthing-common )
12
+ (require 'syncthing-constants )
12
13
(require 'syncthing-errors )
13
14
(require 'syncthing-keyboard )
14
15
34
35
" Throw an error when interacting with a non-widget."
35
36
(syncthing-ert-cleanup)
36
37
(with-temp-buffer
37
- (let (called)
38
- (condition-case err
39
- (syncthing--newline 1 ) ; Move into the button area first
40
- (syncthing-error
41
- (setq called t )
42
- (should (string= (error-message-string err)
43
- (get 'syncthing-error-cant-edit-buffer
44
- 'error-message )))))
38
+ (let (called args)
39
+ (advice-add 'message
40
+ :override
41
+ (lambda (&rest largs ) (setq called t ) (setq args largs)))
42
+ (syncthing--newline 1 ) ; Move into the button area first
43
+ (advice-remove 'message
44
+ (lambda (&rest largs ) (setq called t ) (setq args largs)))
45
+ (should called)
46
+ (should (string= (caddr args) syncthing-msg-cant-edit-buffer))
45
47
(should called))))
46
48
47
49
(ert-deftest syncthing-keyboard-tab-fold-all ()
Original file line number Diff line number Diff line change 9
9
(require 'wid-edit )
10
10
11
11
(require 'syncthing-common )
12
+ (require 'syncthing-constants )
12
13
(require 'syncthing-draw )
13
14
(require 'syncthing-errors )
14
15
(require 'syncthing-state )
@@ -39,7 +40,7 @@ Argument POS Incoming EVENT position."
39
40
(let ((button (syncthing--get-widget pos)))
40
41
(if button
41
42
(widget-apply-action button event)
42
- (signal ' syncthing-error- cant-edit-buffer nil ))))
43
+ (message " %s : %s " syncthing-prefix syncthing-msg- cant-edit-buffer))))
43
44
44
45
(defun syncthing--tab (&rest _ )
45
46
" TAB handler.
You can’t perform that action at this time.
0 commit comments