mirror of
				https://github.com/larstvei/Try.git
				synced 2025-11-04 00:40:11 +00:00 
			
		
		
		
	Let's use try function non-interactively.
This commit is contained in:
		
							parent
							
								
									895ac18d5c
								
							
						
					
					
						commit
						ab17426b51
					
				
							
								
								
									
										14
									
								
								try.el
									
									
									
									
									
								
							
							
						
						
									
										14
									
								
								try.el
									
									
									
									
									
								
							@ -105,7 +105,7 @@
 | 
				
			|||||||
  (lambda (&rest x) (funcall f (apply g x))))
 | 
					  (lambda (&rest x) (funcall f (apply g x))))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
;;;###autoload
 | 
					;;;###autoload
 | 
				
			||||||
(defun try ()
 | 
					(defun try (&optional url-or-package)
 | 
				
			||||||
  "Try out a package from your `package-archives' or pass a URL
 | 
					  "Try out a package from your `package-archives' or pass a URL
 | 
				
			||||||
to a raw .el file. Packages are stored in `try-tmp-dir' and raw
 | 
					to a raw .el file. Packages are stored in `try-tmp-dir' and raw
 | 
				
			||||||
.el files are not stored at all."
 | 
					.el files are not stored at all."
 | 
				
			||||||
@ -116,10 +116,14 @@ to a raw .el file. Packages are stored in `try-tmp-dir' and raw
 | 
				
			|||||||
       (< 1 (length package-archives))
 | 
					       (< 1 (length package-archives))
 | 
				
			||||||
       (package-refresh-contents))
 | 
					       (package-refresh-contents))
 | 
				
			||||||
  ;; Completions for packages.
 | 
					  ;; Completions for packages.
 | 
				
			||||||
  (let* ((url-or-package (completing-read
 | 
					  (let* ((url-or-package
 | 
				
			||||||
                          "url or package: "
 | 
					          (cond ((null url-or-package)
 | 
				
			||||||
                          (mapcar (try-compose 'symbol-name 'car)
 | 
					                 (completing-read
 | 
				
			||||||
                                  package-archive-contents)))
 | 
					                  "url or package: "
 | 
				
			||||||
 | 
					                  (mapcar (try-compose 'symbol-name 'car)
 | 
				
			||||||
 | 
					                          package-archive-contents)))
 | 
				
			||||||
 | 
					                ((symbolp url-or-package) (symbol-name url-or-package))
 | 
				
			||||||
 | 
					                (t url-or-package)))
 | 
				
			||||||
         (package-symbol (intern url-or-package)))
 | 
					         (package-symbol (intern url-or-package)))
 | 
				
			||||||
    (cond ((try-raw-link-p url-or-package) (try-raw-link url-or-package))
 | 
					    (cond ((try-raw-link-p url-or-package) (try-raw-link url-or-package))
 | 
				
			||||||
          ((try-package-exists-p package-symbol)
 | 
					          ((try-package-exists-p package-symbol)
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user