From 4bc5c06c646905e9b904f6a7c9619593cbde6981 Mon Sep 17 00:00:00 2001 From: Tom Willemse Date: Wed, 7 Sep 2016 14:44:12 +0200 Subject: [PATCH] Fix some byte compiler warnings --- emacs/.emacs.d/init.org | 38 +++++++--------------- emacs/.emacs.d/site-lisp/oni-circe.el | 45 +++++++++++++++++++++++++++ emacs/.emacs.d/site-lisp/oni-gnus.el | 37 ++++++++++++++++++++++ 3 files changed, 93 insertions(+), 27 deletions(-) create mode 100644 emacs/.emacs.d/site-lisp/oni-circe.el create mode 100644 emacs/.emacs.d/site-lisp/oni-gnus.el diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index a802bba..6eeceec 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -92,10 +92,11 @@ To start off, first I need to enable lexical binding. and can be used. #+BEGIN_SRC emacs-lisp - (add-to-list 'load-path (locate-user-emacs-file "site-lisp/")) - (let ((loaddefs (locate-user-emacs-file "site-lisp/site-autoloads.el"))) - (when (file-exists-p loaddefs) - (load loaddefs))) + (eval-and-compile + (add-to-list 'load-path (locate-user-emacs-file "site-lisp/")) + (let ((loaddefs (locate-user-emacs-file "site-lisp/site-autoloads.el"))) + (when (file-exists-p loaddefs) + (load loaddefs)))) #+END_SRC * Helper functions @@ -666,14 +667,8 @@ To start off, first I need to enable lexical binding. messages. #+BEGIN_SRC emacs-lisp - (defun oni:gnus-delete-forward () - "Delete the article under point and move to the next one." - (interactive) - (gnus-summary-delete-article) - (gnus-summary-next-subject 1)) - (with-eval-after-load 'gnus - (define-key gnus-summary-mode-map (kbd "M-d") #'oni:gnus-delete-forward)) + (define-key gnus-summary-mode-map (kbd "M-d") 'oni-gnus-delete-forward)) #+END_SRC *** ryuslash.org @@ -788,22 +783,11 @@ To start off, first I need to enable lexical binding. (ensure-library circe) #+END_SRC - I prefer storing my passwords in a GPG encrypted authinfo - file. Circe doesn't look at this out-of-the-box, but it's easy - enough to get this. This function returns a function that will get - a stored password for the given host. + Make sure that Emacs knows these function exist when the file is + being compiled. #+BEGIN_SRC emacs-lisp - (defun oni:circe-get-password-for (host) - (lambda (_) - (let ((found (nth 0 (auth-source-search :max 1 - :host host - :require '(:secret))))) - (when found - (let ((secret (plist-get found :secret))) - (if (functionp secret) - (funcall secret) - secret)))))) + (eval-when-compile (require 'oni-circe)) #+END_SRC I spend most of my time on IRC on Freenode. @@ -822,7 +806,7 @@ To start off, first I need to enable lexical binding. "#linuxvoice" "#conkeror") :nickserv-password - ,(oni:circe-get-password-for "irc.freenode.net")))) + ,(oni-circe-get-password-for "irc.freenode.net")))) #+END_SRC Sometimes I watch some Twitch streams as well. @@ -834,7 +818,7 @@ To start off, first I need to enable lexical binding. :use-tls nil :nick "ryuslash" :host "irc.twitch.tv" - :pass ,(oni:circe-get-password-for "irc.twitch.tv") + :pass ,(oni-circe-get-password-for "irc.twitch.tv") :port 6667))) #+END_SRC diff --git a/emacs/.emacs.d/site-lisp/oni-circe.el b/emacs/.emacs.d/site-lisp/oni-circe.el new file mode 100644 index 0000000..22e5fcd --- /dev/null +++ b/emacs/.emacs.d/site-lisp/oni-circe.el @@ -0,0 +1,45 @@ +;;; oni-circe.el --- Extra commands and functions for circe -*- lexical-binding: t; -*- + +;; Copyright (C) 2016 Tom Willemse + +;; Author: Tom Willemse +;; Keywords: + +;; 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 +;; (at your option) any later version. + +;; This program is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with this program. If not, see . + +;;; Commentary: + +;; Here are some extra commands and functions for circe. + +;;; Code: + +(require 'auth-source) + +;;;###autoload +(defun oni-circe-get-password-for (host) + "Create a function that will get a password for HOST. +The returned function will look for the password in .authinfo, +which may be encrypted." + (lambda (_) + (let ((found (nth 0 (auth-source-search :max 1 + :host host + :require '(:secret))))) + (when found + (let ((secret (plist-get found :secret))) + (if (functionp secret) + (funcall secret) + secret)))))) + +(provide 'oni-circe) +;;; oni-circe.el ends here diff --git a/emacs/.emacs.d/site-lisp/oni-gnus.el b/emacs/.emacs.d/site-lisp/oni-gnus.el new file mode 100644 index 0000000..b525e42 --- /dev/null +++ b/emacs/.emacs.d/site-lisp/oni-gnus.el @@ -0,0 +1,37 @@ +;;; oni-gnus.el --- Extra commands and functions for gnus -*- lexical-binding: t; -*- + +;; Copyright (C) 2016 Tom Willemse + +;; Author: Tom Willemse +;; Keywords: + +;; 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 +;; (at your option) any later version. + +;; This program is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with this program. If not, see . + +;;; Commentary: + +;; Here are some extra commands and functions for gnus. + +;;; Code: + +(require 'gnus-sum) + +;;;###autoload +(defun oni-gnus-delete-forward () + "Delete the article under point and move to the next one." + (interactive) + (gnus-summary-delete-article) + (gnus-summary-next-subject 1)) + +(provide 'oni-gnus) +;;; oni-gnus.el ends here