emacs: Added a function to download a custom script
This commit is contained in:
		
							parent
							
								
									50ec87400c
								
							
						
					
					
						commit
						7e66456fc0
					
				
					 1 changed files with 15 additions and 2 deletions
				
			
		| 
						 | 
					@ -1,8 +1,6 @@
 | 
				
			||||||
;; A few handy functions I use in init.el (or not, but they're nice to
 | 
					;; A few handy functions I use in init.el (or not, but they're nice to
 | 
				
			||||||
;; have)
 | 
					;; have)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
;; Ensure that the themes folder exists
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
(defun custom-download-theme (url filename)
 | 
					(defun custom-download-theme (url filename)
 | 
				
			||||||
  "Downloads a theme through HTTP and places it in ~/.emacs.d/themes"
 | 
					  "Downloads a theme through HTTP and places it in ~/.emacs.d/themes"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -22,6 +20,21 @@
 | 
				
			||||||
    (unless (file-exists-p file)
 | 
					    (unless (file-exists-p file)
 | 
				
			||||||
      (url-copy-file url file))))
 | 
					      (url-copy-file url file))))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					(defun custom-download-script (url filename)
 | 
				
			||||||
 | 
					  "Downloads an Elisp script, places it in ~/.emacs/other and then loads it"
 | 
				
			||||||
 | 
					 
 | 
				
			||||||
 | 
					  ;; Ensure the directory exists
 | 
				
			||||||
 | 
					  (unless (file-exists-p "~/.emacs.d/other")
 | 
				
			||||||
 | 
					    (make-directory "~/.emacs.d/other"))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  ;; Download file if it doesn't exist.
 | 
				
			||||||
 | 
					  (let ((file
 | 
				
			||||||
 | 
					         (concat "~/.emacs.d/" filename)))
 | 
				
			||||||
 | 
					    (unless (file-exists-p file)
 | 
				
			||||||
 | 
					      (url-copy-file url file))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    (load file)))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
;; These come from the emacs starter kit
 | 
					;; These come from the emacs starter kit
 | 
				
			||||||
(defun esk-pretty-lambdas ()
 | 
					(defun esk-pretty-lambdas ()
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue