Showing posts with label emacs. Show all posts
Showing posts with label emacs. Show all posts
Thursday, October 20, 2011
Tuesday, October 11, 2011
Emacs, geben and xdebug
* sudo pecl install xdebug
* edit php.ini
* download geben: http://trac.sakura.ne.jp/geben/
* unpack it into ~/emacs.d/ (emacs includes folder) * add this to your .emacs file:
* open a php service with the parameter
`?XDEBUG_SESSION_START` to start debugging
source
* edit php.ini
zend_extension=/path/to/xdebug.so ; usually /usr/lib/php5/20060613+lfs/xdebug.so [debug] xdebug.remote_autostart=off xdebug.remote_enable=on xdebug.remote_handler=dbgp xdebug.remote_mode=req xdebug.remote_host=localhost xdebug.remote_port=9000* restart apache: /etc/init.d/apache2 restart
* download geben: http://trac.sakura.ne.jp/geben/
* unpack it into ~/emacs.d/ (emacs includes folder) * add this to your .emacs file:
(add-to-list 'load-path "/home/your/emacs.files/geben") (add-to-list 'load-path "/home/your/emacs.files/geben/gud")* restart emacs and run geben with `M-x geben`
* open a php service with the parameter
`?XDEBUG_SESSION_START` to start debugging
source
Wednesday, April 6, 2011
Emacs Tramp Cheatsheet
Open a file on a remote machine:
Sudo with Tramp:
C-c C-f /user@machine:path/to.fileSudo with Tramp:
C-c C-f /sudo::/path/to/file
Source
Tuesday, March 15, 2011
Emacs back references in replace-regex.
From http://www.gnu.org/software/emacs/manual/html_node/emacs/Regexp-Replace.html
In replace-regexp, the newstring need not be constant: it can refer to all or part of what is matched by the regexp. ‘\&’ in newstring stands for the entire match being replaced. ‘\d’ in newstring, where d is a digit, stands for whatever matched the dth parenthesized grouping in regexp. (This is called a “back reference.”) ‘\#’ refers to the count of replacements already made in this command, as a decimal number. In the first replacement, ‘\#’ stands for ‘0’; in the second, for ‘1’; and so on. For example,
M-x replace-regexp <RET> c[ad]+r <RET> \&-safe <RET>
replaces (for example) ‘cadr’ with ‘cadr-safe’ and ‘cddr’ with ‘cddr-safe’.
Tuesday, December 14, 2010
Resolving "murrine_style_draw_box: assertion `height >= -1'"
Finally figured out how to stop this message from popping up after every key stroke if I've launched emacs from a terminal.
Modify the entry in /usr/share/themes/Ambiance/gtk-2.0/gtkrc from GtkRange::trough-under-steppers = 0 to GtkRange::trough-under-steppers = 1. Change Ambiance to whatever theme you are using.
Source: The Hack List
Modify the entry in /usr/share/themes/Ambiance/gtk-2.0/gtkrc from GtkRange::trough-under-steppers = 0 to GtkRange::trough-under-steppers = 1. Change Ambiance to whatever theme you are using.
Source: The Hack List
Tuesday, November 23, 2010
Thursday, November 4, 2010
How to change auto-save-list directory in emacs
To change the auto-save-list directory in emacs, add the following to your .emacs:
;; Put auto-save-list somewhere else
(set 'auto-save-list-file-prefix "~/.trash/.saves-")
Thursday, September 24, 2009
Emacs Bookmarks
`C-x r m '
Set the bookmark for the visited file, at point.
`C-x r m BOOKMARK'
Set the bookmark named BOOKMARK at point (`bookmark-set').
`C-x r b BOOKMARK'
Jump to the bookmark named BOOKMARK (`bookmark-jump').
`C-x r l'
List all bookmarks (`list-bookmarks').
from someone at cmu
Set the bookmark for the visited file, at point.
`C-x r m BOOKMARK
Set the bookmark named BOOKMARK at point (`bookmark-set').
`C-x r b BOOKMARK
Jump to the bookmark named BOOKMARK (`bookmark-jump').
`C-x r l'
List all bookmarks (`list-bookmarks').
from someone at cmu
Wednesday, June 3, 2009
Running functions on marked files in dired mode for emacs.
Source
If you have some function, say some custom refactoring operation, you can call it from a dired buffer, and have it run on each marked file, using the code below.
Go into a dired buffer, mark some files, and then do M-x and run your command. In this case it would be test-for-each-dired-marked-file
If you have some function, say some custom refactoring operation, you can call it from a dired buffer, and have it run on each marked file, using the code below.
Go into a dired buffer, mark some files, and then do M-x and run your command. In this case it would be test-for-each-dired-marked-file
;;; iterating over files in dired
;;; usage example - for-each-dired-marked-file returns a filename and path
;;; for each marked file, so this is what a function using it looks like
(defun view-stuff(filename)
"opens up the file and gets the length of it, then messages the result"
(let (fpath fname mybuffer len)
(setq fpath filename)
(setq fname (file-name-nondirectory fpath))
(setq mybuffer (find-file fpath))
(setq len (buffer-size))
(kill-buffer mybuffer)
(message "Buffer length %d %s" len (buffer-file-name mybuffer))))
; Usage example
(defun test-for-each-dired-marked-file()
(interactive)
(for-each-dired-marked-file 'view-stuff))
(defun for-each-dired-marked-file(fn)
"Do stuff for each marked file, only works in dired window"
(interactive)
(if (eq major-mode 'dired-mode)
(let ((filenames (dired-get-marked-files)))
(mapcar fn filenames))
(error (format "Not a Dired buffer \(%s\)" major-mode))))
Friday, May 29, 2009
Thursday, May 21, 2009
Tuesday, May 5, 2009
Emacs Dired mode quick reference.
Some particular highlights are:
- To enter Dired mode simply do C-x C-f and select a directory
- To open a file or directory, move the cursor to the name of the file you want to edit and hit enter (or e)
- Create a directory - +
- Copy a file - S[hift]-c
- Move/rename a file - S-r
- Delete a file by pressing `d` to mark it for deletion, then press `x` to process all marked files. Press `u` to deselect a file marked for deletion.
- Press `~` to mark all backup files in the current directory for deletion (again, use `x` to actually remove them).
- Refresh the Dired screen with `g`
- Diff two files with `=`
- Mark a file with `m` and then perform a shell command on said marked files with `!`. You can also just run a command with `!`. For example, download a zip file with `!wget www.com/somezipfile.zip` and then with that zipfile under the cursor, run `!unzip`
- And the coolest bit, you can use regex to rename groups of files in a directory with %r. If you have Main.as and Main.2.as and you want to rename them to main.as and main.2.as, you can do `Main\(.+\).as` to `main\1.as`
Subscribe to:
Posts (Atom)