Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

* fixes for some byte-compilation warnings

  • Loading branch information...
commit 7ec409dbaa6fb020e7dd9136c49e5b0318a11d37 1 parent 56af1fe
@djcb authored
Showing with 59 additions and 18 deletions.
  1. +16 −1 Makefile
  2. +15 −6 sauron-dbus.el
  3. +28 −11 sauron.el
View
17 Makefile
@@ -15,6 +15,7 @@
## Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
VERSION=$(shell grep "^;; Version:" sauron.el | sed 's/^[^0-9]*//')
+EMACS=emacs
FILES= sauron.el \
sauron-dbus.el \
@@ -37,5 +38,19 @@ sauron-$(VERSION).tar: $(ELPA_FILES)
sauron-pkg.el: sauron-pkg.el.in sauron.el
sed -e s/@VERSION@/$(VERSION)/ < $< > $@
+
+ELS = $(shell ls -1 *.el)
+ELCS = $(ELS:.el=.elc)
+
+
+.el.elc:
+ $(EMACS) -batch -L . \
+ -eval "(setq max-lisp-eval-depth 1500 max-specpdl-size 3000)" \
+ -eval "(mapc (lambda (dir) (add-to-list 'load-path dir)) (parse-colon-path (getenv \"LOAD_PATH\")))" \
+ -f batch-byte-compile $*.el
+
+# i don't actually care much about byte-compiling, except for debugging...
+bytecompile: $(ELCS)
+
clean:
- rm -rf sauron-pkg.el *.tar *.gz sauron-$(VERSION)
+ rm -rf sauron-pkg.el *.tar *.gz sauron-$(VERSION) $(ELCS)
View
21 sauron-dbus.el
@@ -22,8 +22,17 @@
;; https://github.com/djcb/sauron/blob/master/README.org
;;; Code:
-(unless (require 'dbus nil 'noerror)
- (setq dbus-service-emacs "")) ;; keep errors out if dbus is not there
+(eval-when-compile (require 'cl))
+
+(unless (require 'dbus nil 'noerror)) ;; keep errors out if dbus is not there
+
+;; keep the byte-compiler happy, even if dbus isn't there
+(defvar dbus-service-emacs nil)
+(defvar dbus-path-emacs nil)
+(defvar dbus-interface-introspectable nil)
+(when (not (fboundp 'dbus-unregister-service))
+ (defun dbus-unregister-service (&rest args) nil))
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defvar sauron-dbus-cookie nil
"If non-nil, write the dbus-address for this session to a file
@@ -32,12 +41,12 @@
you can source this in e.g. a shell script:
DBUS_SESSION_BUS_ADDRESS=\"`cat ~/.sauron-dbus`\"
and thus send messages to sauron, even when not in the session.")
-
+
(defconst sr-dbus-service dbus-service-emacs
"*internal* the D-bus service name for sauron.")
(defconst sr-dbus-path
- (concat dbus-path-emacs "/Sauron")
+ (concat (or dbus-path-emacs "" ) "/Sauron")
"*internal* the D-bus interface for sauron.")
(defconst sr-dbus-interface
@@ -68,7 +77,7 @@ and thus send messages to sauron, even when not in the session.")
(dbus-register-method
:session ;; bus to use (:session or :system)
sr-dbus-service ;; ie. org.gnu.Emacs or org.gnu.Emacs.<username>
- sr-dbus-path ;; ie. org.gnu.Emacs.Sauron
+ sr-dbus-path ;; ie. org.gnu.Emacs.Sauron
dbus-interface-introspectable
"Introspect"
(lambda () ;; return the introspection XML for our object"
@@ -104,7 +113,7 @@ return t, otherwise, return nil."
(progn
(message "sauron-dbus: not available")
nil)
- (ignore-errors
+ (ignore-errors
(when (not sr-dbus-running)
(sr-register-methods)
(when sauron-dbus-cookie
View
39 sauron.el
@@ -120,42 +120,56 @@ PROPS is a backend-specific plist.")
;; faces; re-using the font-lock stuff...
+(defgroup sauron-faces nil
+ "Faces for sauron."
+ :group 'local
+ :group 'faces)
+
(defface sauron-timestamp-face
'((t :inherit font-lock-type-face))
- "Face for a sauron time stamp.")
+ "Face for a sauron time stamp."
+:group 'sauron-faces)
(defface sauron-message-face
'((t :inherit font-lock-preprocessor-face))
- "Face for a sauron event message.")
+ "Face for a sauron event message."
+ :group 'sauron-faces)
(defface sauron-origin-face
'((t :inherit font-lock-variable-name-face))
- "Face for a sauron event origin.")
+ "Face for a sauron event origin."
+ :group 'sauron-faces)
(defface sauron-priority-face
'((t :inherit font-lock-operator))
- "Face for a sauron event priority.")
+ "Face for a sauron event priority."
+ :group 'sauron-faces)
;; these highlight faces are for use in backends
(defface sauron-highlight1-face
'((t :inherit font-lock-pseudo-keyword-face))
- "Face to highlight certain things (1) - for use in backends.")
+ "Face to highlight certain things (1) - for use in backends."
+ :group 'sauron-faces)
(defface sauron-highlight2-face
'((t :inherit font-lock-string-face :italic t))
- "Face to highlight certain things (2) - for use in backends.")
+ "Face to highlight certain things (2) - for use in backends."
+ :group 'sauron-faces)
(defface sauron-highlight3-face
'((t :inherit font-lock-constant-face))
- "Face to highlight certain things (3) - for use in backends..")
+ "Face to highlight certain things (3) - for use in backends.."
+ :group 'sauron-faces)
(defface sauron-header-face
'((t :inherit font-lock-function-name-face :bold t))
- "Face for the header line.")
+ "Face for the header line."
+ :group 'sauron-faces)
(defface sauron-event-handled-face
'((t :strike-through t))
- "Face for a handled event.")
+ "Face for a handled event."
+:group 'sauron-faces)
;;(setq sauron-mode-map nil)
(defvar sauron-mode-map
@@ -212,7 +226,7 @@ e.g. when using ERC")
\\{sauron-mode-map}."
(setq
- truncate-lines t
+ truncate-lines t
buffer-read-only t
overwrite-mode 'overwrite-mode-binary)
(sr-set-header-line))
@@ -341,6 +355,9 @@ For debugging purposes."
str)))
sauron-column-alist " "))
+(defvar sr-buffer nil
+ "*internal* The sauron buffer.")
+
(defun sr-scroll-to-bottom ()
"Scroll to the bottom of the sauron frame."
(dolist (win (get-buffer-window-list sr-buffer nil t))
@@ -349,7 +366,7 @@ For debugging purposes."
(recenter -1))))
-;; the main work horse functions
+;; the main work horse function
(defun sauron-add-event (origin prio msg &optional func props)
"Add a new event to the Sauron log with:
ORIGIN the source of the event (e.g., 'erc or 'dbus or 'org)
Please sign in to comment.
Something went wrong with that request. Please try again.