From 99f78178964d12e3a8ae6cc4aebf894320e562df Mon Sep 17 00:00:00 2001 From: Miquel Sabaté Solà Date: Thu, 5 Sep 2019 14:00:25 +0200 Subject: Added linters and polished code MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The minimum version supported has been raised to 25.3. Signed-off-by: Miquel Sabaté Solà --- .emacs.d/lisp/g.el | 36 ++++++++++++++++++++---------------- 1 file changed, 20 insertions(+), 16 deletions(-) (limited to '.emacs.d/lisp') diff --git a/.emacs.d/lisp/g.el b/.emacs.d/lisp/g.el index 3a4660a..fe842d8 100644 --- a/.emacs.d/lisp/g.el +++ b/.emacs.d/lisp/g.el @@ -1,7 +1,15 @@ -;;; g.el --- Adding shortcuts to GNU Emacs - +;;; g.el --- Adding shortcuts -*- lexical-binding: t; -*- +;; ;; Copyright (C) 2016-2019 Miquel Sabaté Solà ;; +;; Author: Miquel Sabaté Solà +;; Version: 0.1 +;; Package-Requires: ((emacs "25.1")) +;; Keywords: abbrev, convenience +;; URL: https://github.com/mssola/dotfiles/.emacs.d/lisp/g.el +;; +;; This file is not part of GNU Emacs. +;; ;; This program is free software: you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by ;; the Free Software Foundation, either version 3 of the License, or @@ -14,11 +22,7 @@ ;; ;; You should have received a copy of the GNU General Public License ;; along with this program. If not, see . - -;; Author: Miquel Sabaté Solà -;; Version: 0.1 -;; URL: https://github.com/mssola/dotfiles/emacs/site-lisp/g.el - +;; ;;; Commentary: ;; ;; This is a GNU Emacs port of my g.sh bash script that can be found here: @@ -33,15 +37,15 @@ (defvar g-file "~/.gfile" "The path to the gfile.") -;; Utils +;;; Utils (defun g-read-file (file) "Read the given FILE and return it as a list of lines." (if (file-exists-p file) - (with-temp-buffer - (insert-file-contents file) - (split-string (buffer-string) "\n" t)) + (with-temp-buffer + (insert-file-contents file) + (split-string (buffer-string) "\n" t)) "")) (defun g-write (shortcuts) @@ -61,18 +65,18 @@ The returned object is a hash table." (let ((shortcuts (make-hash-table :test 'equal)) (list (g-read-file g-file))) - ; The format of the file is a bit special because it was meant to be easily - ; parseable by Bash. It consists of pairs of lines, where n is the key, and - ; n+1 is the value. + ;; The format of the file is a bit special because it was meant to be easily + ;; parseable by Bash. It consists of pairs of lines, where n is the key, and + ;; n+1 is the value. (dotimes (i (/ (length list) 2)) (let ((n (* i 2))) (puthash (nth n list) (nth (+ n 1) list) shortcuts))) - shortcuts)) + shortcuts)) -;; Interactive functions +;;; Interactive functions (defun g () "Go to the given directory with the supplied alias." -- cgit v1.2.3