Warning, /sdk/kde-dev-scripts/kde-emacs/kde-emacs-bindings.el is written in an unsupported language. File is not indexed.
0001 ;; kde-emacs-bindings.el
0002 ;;
0003 ;; Copyright (C) 2002 KDE Development Team
0004 ;;
0005 ;; This library is free software; you can redistribute it and/or
0006 ;; modify it under the terms of the GNU Lesser General Public
0007 ;; License as published by the Free Software Foundation; either
0008 ;; version 2.1 of the License, or (at your option) any later version.
0009 ;;
0010 ;; This library is distributed in the hope that it will be useful,
0011 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
0012 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
0013 ;; Lesser General Public License for more details.
0014 ;;
0015 ;; You should have received a copy of the GNU Lesser General Public
0016 ;; License along with this library; if not, write to the Free Software
0017 ;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
0018 ;; 02110-1301 USA
0019
0020 ; currently no binding for header-protection and add-file-to-makefile-am,
0021 ; you need to call them from M-x
0022
0023 ; -----------------------------------------------------------------
0024 ; The list below defines the following bindings:
0025 ;
0026 ; F2 : offer a grep command (use C-u F2 if you need to specify options, like -i or -w)
0027 ; Shift-F2 : offer a grep command to search in directories below the current too..
0028 ;
0029 ; F3/Shift-F3/F8/Shift-RMB : different ways to see the list of methods in the current buffer
0030 ;
0031 ; F4 : make
0032 ; Shift-F4 : make clean
0033 ; F5 : make install
0034 ; Shift-F5 : make install-exec
0035 ;
0036 ; Shift-F6 : compile this file [assumes libtool is being used]
0037 ; F6 : Switch from .cpp/.cc to .h and vice-versa
0038 ; F7 : The same, but try to find the current method in the other file
0039 ; F9 : Create a member method in the .cpp, the cursor being on the definition in the .h
0040 ; F10: Place point on a class name, and the respective (Qt) include file will be inserted.
0041 ; This works with all Qt classes but can easily be extended to KDE classes.
0042 ; Shift-F10: Place point on a class name, and "class Blah" will be inserted near the top.
0043 ; Meta-F10: Place point on a class name, and press Meta-F10, and konqueror will load
0044 ; Qt documentation. Customize the location of the Qt documentation with the
0045 ; variable kdab-qt-documentation. XXX will be replace with the class name.
0046 ; Example (setq kdab-qt-location "file:/packages/kde-src/qt-copy/doc/html/XXX.html")
0047 ;
0048 ; M-n: jump to the next error (after compiling) or grep matches
0049 ;
0050 ; Ctrl+Meta+D : insert a kDebug statement with the name of the current method
0051 ; [the new hide-all-windows shortcut conflicts with that, you may have to
0052 ; change it, or use Ctrl+Meta+Shift+D (!!)]
0053 ;
0054 ; Meta Up/Down : scroll the other window (when window is split)
0055
0056 ; Other very useful keybindings to know about:
0057 ; C-x r m to set a named bookmark in the buffer
0058 ; C-x r b to jump to a named bookmark in the buffer
0059 ; To save bookmarks to a file type:
0060 ; M-x bookmark-write
0061 ; and to load bookmarks from a file write:
0062 ; M-x bookmark-load
0063
0064 (require 'kde-emacs-core)
0065 (require 'kde-emacs-general)
0066 (require 'kde-emacs-utils)
0067 (require 'klaralv)
0068 (require 'kde-emacs-utils)
0069 (when (featurep 'semantic)
0070 (require 'kde-emacs-semantic)
0071 (require 'kde-emacs-doc))
0072
0073 ;; Wheelmouse support
0074 (define-key global-map [(button4)] 'scroll-me-down)
0075 (define-key global-map [(button5)] 'scroll-me-up)
0076 (define-key global-map [(shift button4)] 'scroll-me-down-a-bit)
0077 (define-key global-map [(shift button5)] 'scroll-me-up-a-bit)
0078
0079 ;; Some example bindings, feel free to customize :)
0080 (define-key global-map [(meta up)] 'scroll-other-up)
0081 (define-key global-map [(meta down)] 'scroll-other-down)
0082 (global-set-key [(control j)] 'goto-line)
0083 (global-set-key [(control %)] 'match-paren) ;;for all buffers :)
0084
0085 (if (featurep 'igrep)
0086 (progn
0087 (setq igrep-find-prune-clause
0088 (format "-type d %s -name CVS -o -name .libs -o -name .deps -o -name .svn %s"
0089 (shell-quote-argument "(")
0090 (shell-quote-argument ")")))
0091 (setq igrep-find-file-clause
0092 (format "-type f %s -name %s %s -name %s %s -name %s %s -name %s" ; -type l
0093 (shell-quote-argument "!")
0094 (shell-quote-argument "*~") ; Emacs backup
0095 (shell-quote-argument "!")
0096 (shell-quote-argument "*,v") ; RCS file
0097 (shell-quote-argument "!")
0098 (shell-quote-argument "s.*") ; SCCS file
0099 (shell-quote-argument "!")
0100 (shell-quote-argument "*.o") ; compiled object
0101 (shell-quote-argument "!")
0102 (shell-quote-argument ".#*") ; Emacs temp file
0103 )
0104 )
0105 (define-key global-map [(f2)] 'igrep)
0106 (define-key global-map [(shift f2)] 'igrep-find)
0107 (define-key global-map [(f12)] 'igrep-find) ; on the console, shift f2 gives f12 for some reason..
0108 ;(setq igrep-files-default 'ignore) ; too hard to use *.cc *.h with it, because of the full path
0109 )
0110 (define-key global-map [(f2)] 'grep))
0111 (define-key global-map [(shift backspace)] 'kde-delete-backward-ws)
0112
0113 ;; FIXME: remember to get these working on Gnu/Emacs (Zack)
0114 (when (eq kde-emacs-type 'xemacs)
0115 (define-key c++-mode-map [(f8)] 'function-menu)
0116 (define-key c++-mode-map [(f3)] 'fume-prompt-function-goto)
0117 (define-key c++-mode-map [(shift f3)] 'fume-list-functions)
0118 )
0119
0120 (define-key global-map [(shift button3)] 'mouse-function-menu)
0121 (if kde-emacs-newline-semicolon
0122 (define-key c++-mode-map "\;" 'insert-semicolon))
0123
0124 (if kde-emacs-use-qtcreator-shortcuts
0125 (progn
0126 ;(define-key global-map [(shift f4)] 'makeclean)
0127 (define-key global-map [(control b)] 'make)
0128 (define-key global-map [(control B)] 'makeinstall)
0129 ;(define-key global-map [(shift f5)] 'makeinstallexec) ; TODO replace with run-current-program
0130 (define-key global-map [(shift f6)] 'makethisfile)
0131 (define-key c++-mode-map [(f4)] 'kde-switch-cpp-h)
0132 (define-key c-mode-map [(f4)] 'kde-switch-cpp-h)
0133 (define-key c++-mode-map [(shift f2)] 'switch-to-function-def)
0134 (define-key c-mode-map [(shift f2)] 'switch-to-function-def)
0135 (define-key c++-mode-map [(control shift f2)] 'agulbra-make-member)
0136 (define-key c-mode-map [(control shift f2)] 'agulbra-make-member)
0137 (define-key global-map [(f6)] 'next-error)
0138 )
0139 ; else
0140 (progn ; Historic default keybindings
0141 (define-key global-map [(shift f4)] 'makeclean)
0142 (define-key global-map [(f4)] 'make)
0143 (define-key global-map [(f5)] 'makeinstall)
0144 (define-key global-map [(shift f5)] 'makeinstallexec) ; TODO replace with run-current-program
0145 (define-key c++-mode-map [(f6)] 'kde-switch-cpp-h)
0146 (define-key c-mode-map [(f6)] 'kde-switch-cpp-h)
0147 (define-key c++-mode-map [(f7)] 'switch-to-function-def)
0148 (define-key c-mode-map [(f7)] 'switch-to-function-def)
0149 (define-key c++-mode-map [(f9)] 'agulbra-make-member)
0150 (define-key c-mode-map [(f9)] 'agulbra-make-member)
0151 (define-key global-map [(meta n)] 'next-error)
0152 )
0153 )
0154
0155 ; kde-emacs-headers:
0156 (define-key c++-mode-map [(f10)] 'kdab-insert-header)
0157 (define-key c++-mode-map [(shift f10)] 'kdab-insert-forward-decl)
0158 (define-key c++-mode-map [(meta f10)] 'kdab-lookup-qt-documentation)
0159 (define-key c++-mode-map [(control meta d)] 'insert-kDebug)
0160
0161 ; Standard Qt/KDE shortcuts: Ctrl+Backspace, Ctrl+Delete
0162 (define-key global-map [(control backspace)] 'backward-kill-word)
0163 (define-key global-map [(control delete)] 'kill-word)
0164
0165 ; Standard Qt/KDE shortcuts: Control Pageup and Pagedown
0166 (define-key global-map [(control prior)] 'beginning-of-buffer)
0167 (define-key global-map [(control next)] 'end-of-buffer)
0168
0169 ; kde-emacs-semantic :
0170 ; no binding for kde-license-insert; call it via M-x
0171 (when (featurep 'semantic)
0172 (define-key c++-mode-map [(control c)(control k)(d)] 'kde-doc-function-insert)
0173 (define-key c++-mode-map [(control c)(control k)(m)] 'kde-doc-multiline-insert)
0174 (define-key c++-mode-map [(control c)(control k)(o)] 'kde-doc-oneliner-insert)
0175 (define-key c++-mode-map [(control c)(control k)(e)] 'kde-function-expand-at-point)
0176 (define-key c++-mode-map [(control c)(control k)(s)] 'kde-create-skeletons))
0177
0178 (modify-frame-parameters (selected-frame) '((menu-bar-lines . 2)))
0179 (define-key c++-mode-map [menu-bar KDE]
0180 (cons "KDE" c++-mode-map))
0181 (when (featurep 'semantic)
0182 (define-key c++-mode-map [menu-bar KDE kde-doc-function-insert]
0183 '("kde-doc-function-insert" . kde-doc-function-insert))
0184 (define-key c++-mode-map [menu-bar KDE kde-function-expand-at-point]
0185 '("kde-function-expand-at-point" . kde-function-expand-at-point))
0186 (define-key c++-mode-map [menu-bar KDE kde-create-skeletons]
0187 '("kde-create-skeletons" . kde-create-skeletons))
0188 (define-key c++-mode-map [menu-bar KDE kde-doc-multiline-insert]
0189 '("kde-doc-multiline-insert" . kde-doc-multiline-insert)))
0190 (define-key c++-mode-map [menu-bar KDE makeclean]
0191 '("make clean" . makeclean))
0192 (define-key c++-mode-map [menu-bar KDE make]
0193 '("make" . make))
0194 (define-key c++-mode-map [menu-bar KDE makeinstall]
0195 '("make install" . makeinstall))
0196 (define-key c++-mode-map [menu-bar KDE makethisfile]
0197 '("make this file" . makethisfile))
0198 (define-key c++-mode-map [menu-bar KDE kdeswitchcpph]
0199 '("Switch to .h/.cpp file" . kde-switch-cpp-h))
0200 (define-key c++-mode-map [menu-bar KDE insert-kDebug]
0201 '("Insert kDebug" . insert-kDebug))
0202
0203
0204 (provide 'kde-emacs-bindings)
0205