;;; -*- Mode: Lisp, Editor; Package: Hemlock -*- (in-package :hemlock) ;;; Load code files first -- some useful functions might be defined there. ;;; (load #p"home:src/hemlock-customizations/fix.lisp") (load #p"home:src/hemlock-customizations/custom.lisp") ;;; The customizations ;;; I have these modifiers defined: ;;; Mod1 - Alt ;;; Mod2 - Meta ;;; Mod3 - Mode_switch (for Latvian character input) ;;; Mod4 - Num_Lock ;;; Mod5 - Hyper (define-clx-modifier (xlib:make-state-mask :mod-2) "Meta") (define-clx-modifier (xlib:make-state-mask :mod-5) "Hyper") ;(setv default-font "-adobe-courier-medium-r-normal-*-12-*-*-*-m-*-iso8859-13") ;(setv active-region-highlighting-font "-adobe-courier-bold-o-normal-*-12-*-*-*-m-*-iso8859-13") ;(setv open-paren-highlighting-font "-adobe-courier-bold-r-normal-*-12-*-*-*-m-*-iso8859-13") ;;; I'm still deciding which set to use... ;;; (setv default-font "-misc-fixed-medium-r-normal-*-*-120-*-*-c-*-iso8859-13") (setv active-region-highlighting-font "-misc-fixed-bold-r-normal-*-*-120-*-*-c-*-iso8859-13") (setv open-paren-highlighting-font "-misc-fixed-bold-r-normal-*-*-120-*-*-c-*-iso8859-13") (setv thumb-bar-meter nil) (setv beep-border-width 2) ;;(setv bell-style :border-flash) (setv default-initial-window-width 100) (setv default-initial-window-height 70) ;;; comment column best used with keys: M-;, M-n, M-p, and C-M-; (setv comment-column 40) (setv indent-with-tabs #'indent-using-spaces) (setv add-newline-at-eof-on-writing-file t) ;;; Utility function to remove a key binding in *all* modes. ;;; (defun delete-all-key-bindings (key) ;; Should interactively or somehow ask the user if it is really what he ;; wants. Maybe if an optional parameter is set. (do-strings (mode-name mode *mode-names*) (declare (ignore mode)) (delete-key-binding key :mode mode-name)) ;; Maybe also unbind in all buffers? But that's not really needed in ;; init file... ;; Finally remove a global binding. (delete-key-binding key :global)) ;;; Key bindings ;;; (bind-key "Undo" #k"C-_" :global) ;;; Delete key is bound to Delete Previous Character [Expanding Tabs] ;;; everywhere, same as Backspace. On my keyboard I have both these keys, ;;; and Delete usually deletes forward. (delete-all-key-bindings #k"Delete") (bind-key "Delete Next Character" #k"Delete") (bind-key "Extract Form" #k"C-c r" :mode "Lisp") (bind-key "Next Window" #k"C-tab" :global) (bind-key "Scroll Window Up" #k"Pageup" :global) (bind-key "Scroll Window Down" #k"Pagedown" :global) (bind-key "Help" #k"C-h") ;;; Mouse bindings (bind-key "Point To Here" #k"Leftdown") (bind-key "Generic Pointer Up" #k"Leftup") (bind-key "Insert Kill Buffer" #k"Middledown") (bind-key "Do Nothing" #k"Middleup") (bind-key "Here to Top of Window" #k"S-Leftdown") (bind-key "Top Line to Here" #k"S-Rightdown") (dolist (key (list #k"Rightdown" #k"Rightup")) (delete-key-binding key)) ;;; Make hemlock recognize mouse wheel. (Not sure about the constants ;;; 256xx -- I interpolated from "keysym-defs.lisp".) ;;; (ext:define-mouse-keysym 4 25607 "Button4down" "Super" :button-press) (ext:define-mouse-keysym 4 25608 "Button4up" "Super" :button-release) (ext:define-mouse-keysym 5 25609 "Button5down" "Super" :button-press) (ext:define-mouse-keysym 5 25610 "Button5up" "Super" :button-release) ;;; Now make Hemlock use the wheel ;;; (defcommand "Scroll Window Up Slightly" (p) "Scrolls window up slightly (5 lines). Used for mouse wheel scrolling. The prefix argument is ignored." "Scrolls window up 5 lines." (declare (ignore p)) (scroll-window-up-command 5)) (defcommand "Scroll Window Down Slightly" (p) "Scrolls window down slightly (5 lines). Used for mouse wheel scrolling. The prefix argument is ignored." "Scrolls window down 5 lines." (declare (ignore p)) (scroll-window-down-command 5)) ;;; Normal scrolling (bind-key "Scroll Window Up Slightly" #k"Button4down") (bind-key "Do Nothing" #k"Button4up") (bind-key "Scroll Window Down Slightly" #k"Button5down") (bind-key "Do Nothing" #k"Button5up") ;;; Scrolling with Control key pressed -- by screenfuls (bind-key "Scroll Window Up" #k"C-Button4down") (bind-key "Do Nothing" #k"C-Button4up") (bind-key "Scroll Window Down" #k"C-Button5down") (bind-key "Do Nothing" #k"C-Button5up") ;;; Scrolling by single line -- i don't use it :) ;;(bind-key "Scroll Window Up One" #k"S-Button4down") ;;(bind-key "Do Nothing" #k"S-Button4up") ;;(bind-key "Scroll Window Down One" #k"S-Button5down") ;;(bind-key "Do Nothing" #k"S-Button5up") ;;; I'm too used to tab doing completion ;;; (bind-key "Help on Parse" #k"Tab" :mode "Echo Area") ;;; Slave stuff ;;; (setv slave-utility-switches '("-core" "/home/jdz/lisp-with-hemlock.core")) ;;; TODO: ;;; - Check out a way to navigate back after finding source with C-M-F. ;;; NOTES: ;;; - Commands bound to mouse buttons can be found using "Describe Pointer" ;;; ;;; - Exit Hemlock is bound to C-x C-z. ;;; With prefix argument, will display a list of modified buffers. ;;; Exiting with C-x M-z (Save All Files and Exit) will safe all buffers ;;; with associated files. ;;; ;;; - Should start using page delimiters (^L) and page navigation functions: ;;; Previous Page (C-x [), Next Page (C-x ]), View Page Directory ;;; ;;; - Put Register (C-x x) and Get Register (C-x g) are interesting. ;;; ;;; - The command New Window (C-x C-n) creates a new window. ;;; ;;; - Dired can be invoked by C-x C-M-d. View file is Space, edit is e. ;;; ;;; - Defindent (C-M-#) can be used to define special indantanion for ;;; some forms. ;;; ;;; - C-M-F is Goto Definition. ;;; ;;; - Go To One Window might prove useful when the main window suddenly is ;;; lost... ;;; ;;; - C-M-c goes to the slave buffer, C-M-C goes to the slave background ;;; buffer. These are really useful when developing. M-i kills the ;;; input (in Typescript buffer) that would go to the slave process if ;;; Return was pressed. There's a useful editor command "Re-evaluate ;;; Defvar" also. Compile buffer file is bound co #k"C-x c". Other ;;; useful commands: Typescript Slave BREAK (H-b), Typescript Slave to ;;; Top Level (H-g), Typescript Slave Status (H-s). ;;; ;;; italic comment mode does not do anything (visual at least) ;;; ;;; use Select Eval Buffer command to start a REPL ;;; #| Use this to create a hemlock image: (require 'cmucl-hemlock) (ext:save-lisp "hemlock.core" :purify t ;;; :print-herald nil ;;; :init-function #'(lambda () ;;; (ignore-errors ;;; (ed (car ext:*command-line-words*)) ;;; (unix:unix-exit))) ) And I have an executable file ~/bin/hemlock (which is in my $PATH) with following contents: #!/bin/bash exec lisp $1 -core /home/jdz/hemlock.core It probably could also be possible to make binfmt_misc to recognize CMUCL's core files... |#