Fix some byte compiler warnings

This commit is contained in:
Tom Willemse 2016-09-07 14:44:12 +02:00
parent d153d12869
commit 4bc5c06c64
3 changed files with 93 additions and 27 deletions

View file

@ -92,10 +92,11 @@ To start off, first I need to enable lexical binding.
and can be used. and can be used.
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(eval-and-compile
(add-to-list 'load-path (locate-user-emacs-file "site-lisp/")) (add-to-list 'load-path (locate-user-emacs-file "site-lisp/"))
(let ((loaddefs (locate-user-emacs-file "site-lisp/site-autoloads.el"))) (let ((loaddefs (locate-user-emacs-file "site-lisp/site-autoloads.el")))
(when (file-exists-p loaddefs) (when (file-exists-p loaddefs)
(load loaddefs))) (load loaddefs))))
#+END_SRC #+END_SRC
* Helper functions * Helper functions
@ -666,14 +667,8 @@ To start off, first I need to enable lexical binding.
messages. messages.
#+BEGIN_SRC emacs-lisp #+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 (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 #+END_SRC
*** ryuslash.org *** ryuslash.org
@ -788,22 +783,11 @@ To start off, first I need to enable lexical binding.
(ensure-library circe) (ensure-library circe)
#+END_SRC #+END_SRC
I prefer storing my passwords in a GPG encrypted authinfo Make sure that Emacs knows these function exist when the file is
file. Circe doesn't look at this out-of-the-box, but it's easy being compiled.
enough to get this. This function returns a function that will get
a stored password for the given host.
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(defun oni:circe-get-password-for (host) (eval-when-compile (require 'oni-circe))
(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))))))
#+END_SRC #+END_SRC
I spend most of my time on IRC on Freenode. 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" "#linuxvoice"
"#conkeror") "#conkeror")
:nickserv-password :nickserv-password
,(oni:circe-get-password-for "irc.freenode.net")))) ,(oni-circe-get-password-for "irc.freenode.net"))))
#+END_SRC #+END_SRC
Sometimes I watch some Twitch streams as well. 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 :use-tls nil
:nick "ryuslash" :nick "ryuslash"
:host "irc.twitch.tv" :host "irc.twitch.tv"
:pass ,(oni:circe-get-password-for "irc.twitch.tv") :pass ,(oni-circe-get-password-for "irc.twitch.tv")
:port 6667))) :port 6667)))
#+END_SRC #+END_SRC

View file

@ -0,0 +1,45 @@
;;; oni-circe.el --- Extra commands and functions for circe -*- lexical-binding: t; -*-
;; Copyright (C) 2016 Tom Willemse
;; Author: Tom Willemse <tom@ryuslash.org>
;; 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 <http://www.gnu.org/licenses/>.
;;; 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

View file

@ -0,0 +1,37 @@
;;; oni-gnus.el --- Extra commands and functions for gnus -*- lexical-binding: t; -*-
;; Copyright (C) 2016 Tom Willemse
;; Author: Tom Willemse <tom@ryuslash.org>
;; 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 <http://www.gnu.org/licenses/>.
;;; 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