Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ;; creates .gitignore file
- ;;
- ;; added a check, so that if a .gitignore exists already it doesn't overwrite it
- (defun gitignore(dir)
- "create .gitignore file in a directory supplied
- populating it with the patterns/files"
- (interactive "DDirectory name: ")
- (setq ignore-patterns
- ;; modify patterns/files below as per your need
- '("*~"
- "log/*.log"
- "tmp/**/*"
- "config/database.yml"
- "db/*.sqlite3"))
- (setq .gitignore (concat (file-name-as-directory dir) ".gitignore"))
- (if (file-exists-p .gitignore)
- (progn
- (message "%s exists already, nothing new was added" .gitignore)
- (find-file .gitignore))
- (progn
- (switch-to-buffer .gitignore)
- (while ignore-patterns
- (insert-string (concat (car ignore-patterns) "\n"))
- (setq ignore-patterns (cdr ignore-patterns)))
- (message "%s created" .gitignore))))
Add Comment
Please, Sign In to add comment