(defun tj-find-file-check-make-large-file-read-only-hook () "If a file is over a given size, make the buffer read only." (when (> (buffer-size) (* 1024 1024)) (setq buffer-read-only t) (buffer-disable-undo) (message "Buffer is set to read-only because it is large. Undo also disabled.")))

;; fm package that highlights corresponding line in source buffer as one moves through the output (occur, compilation, ...) buffer.(require 'fm)(add-hook 'occur-mode-hook 'fm-start)(add-hook 'compilation-mode-hook 'fm-start);; Once following is activated in a buffer, it can be toggled with the "f" key in that buffer.

One trick I use a lot is when I'm looking at a lengthy debug log over and over. Typically, there will be certain changes that will help me decipher what's going on: maybe I'm stripping off the timestamp because I don't care, or I'm highlighting a key variable. It all depends on the project.

The emacs trick is that I wrap my edits into one routine, changing it as needed. Automagically, the debug logs are closer to what I need.

(defun fix-order () "Make assorted sorts to narrowed output of ItineraryViewController debug statements. if you aren't set up with the right narrowed, timestamped buffer, this command will arbitrarily scramble everything.

1. select the part of code (with mouse) in your browser.2. middle click somewhere (probabily at the end) in your dotemacs buffer or C-y3. C-M-\ to properly indent the code. (you don't want to rely on parenthesis much, you rely on indentation to read the code)4. M-x eval-region (to check the code actually works. some blog automatically changes quote and double quotes symbols.)

And try C-h f, C-h F and C-h v at various points to see what all those functions, variables, modes and hooks mean.

Here's my share.

;; [usage-memo] [umemo] (integration of memo and help) ;; put it before all minor mode. ;; you write memo at the end of Help buffer and press C-x C-s to save it.(require 'usage-memo)(umemo-initialize)(setq umemo-base-directory "~/em/umemo/") ; need not create the dir by hand.

;; [truncate] soft word wrapping mode on and off in emacs. ;; This does not change the content of the buffer.;; (setq-default truncate-lines t) ; truncate lines by default, i.e. put soft word wrapping mode off by default. You need truncate-lines mode to easily read a big ascii table and a deeply indented code with many very long lines.(global-set-key (kbd "\C-c w") 'toggle-truncate-lines)

Pertinent to the last suggestion by yoosblog about turning word wrap on, consider also adding:(setq truncate-partial-width-windows nil), Setting this the toggle-truncate trick will be possible in buffers into a split of windows. It overrides truncate functionality, which otherwise wouldn't work in a buffer contained in a frame split with two or more windows.