main: Make 'catch-mcron-error' macro hygienic.
* scm/mcron/main.scm (catch-mcron-error): Use 'define-syntax-rule' instead of 'defmacro'.
This commit is contained in:
		
					parent
					
						
							
								c8a1238396
							
						
					
				
			
			
				commit
				
					
						2947d84101
					
				
			
		
					 1 changed files with 7 additions and 13 deletions
				
			
		| 
						 | 
					@ -64,20 +64,14 @@ When COMMAND is not specified this uses the first element of (command-line)."
 | 
				
			||||||
  (when (and exit-code (not (eq? exit-code 0)))
 | 
					  (when (and exit-code (not (eq? exit-code 0)))
 | 
				
			||||||
    (primitive-exit exit-code)))
 | 
					    (primitive-exit exit-code)))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					(define-syntax-rule (catch-mcron-error exp ...)
 | 
				
			||||||
 | 
					  "Evaluate EXP .... if an 'mcron-error exception occurs, print its diagnostics
 | 
				
			||||||
;; Code contributed by Sergey Poznyakoff.  Execute body. If an 'mcron-error
 | 
					and exit with its error code."
 | 
				
			||||||
;; exception occurs, print its diagnostics and exit with its error code.
 | 
					  (catch 'mcron-error
 | 
				
			||||||
 | 
					    (lambda () exp ...)
 | 
				
			||||||
(defmacro catch-mcron-error (. body)
 | 
					 | 
				
			||||||
  `(catch 'mcron-error
 | 
					 | 
				
			||||||
          (lambda ()
 | 
					 | 
				
			||||||
            ,@body)
 | 
					 | 
				
			||||||
    (lambda (key exit-code . msg)
 | 
					    (lambda (key exit-code . msg)
 | 
				
			||||||
      (apply mcron-error exit-code msg))))
 | 
					      (apply mcron-error exit-code msg))))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
;; We will be doing a lot of testing of the command name, so it makes sense to
 | 
					;; We will be doing a lot of testing of the command name, so it makes sense to
 | 
				
			||||||
;; perform the string comparisons once and for all here.
 | 
					;; perform the string comparisons once and for all here.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue