Innehållsförteckning RecentChanges News ElispArea HowTo Problems Suggestions

AaronBrady

Last edit

Ändrad:

< contact me at (concat (format "%c%s%d%s%s" ?a "brady" (* 2 (- 1 1)) "@" "yahoo") ".com")
< == Overlay bookmarks ==
< [new]
< Since [[overlay]]s do a better job of tracking lines of code than saving the [[point]] does,
I wrote a set of overlay-bookmark functionality:
< {{{
< (defun filter (fn lst)
< (let ((acc nil))
< (dolist (x lst)
< (let ((val (funcall fn x)))
< (if val (push val acc))))
< (nreverse acc)))
< (defun setOverlayBookmark ()
< (interactive)
< (let*
< ((pnt (line-beginning-position))
< (ovrly (make-overlay pnt (line-end-position))))
< (overlay-put ovrly 'face 'highlight)
< (overlay-put ovrly 'pointHistory t)
< ovrly))
< (defun overlayBookmarkFilterFunc (ovrly) (and (overlay-get ovrly 'pointHistory) ovrly))
< (defun overlayBookmarkFilterStartsFunc (ovrly) (and (overlay-get ovrly 'pointHistory) (overlay-start ovrly)))
< (defun nextOverlayBookmark ()
< (interactive)
< (let*
< (
< (pnt (line-end-position))
< (ovrly_starts (or (filter 'overlayBookmarkFilterStartsFunc (overlays-in pnt (point-max)))
< (filter 'overlayBookmarkFilterStartsFunc (overlays-in (point-min) pnt)))))
< (if ovrly_starts
< (goto-char (reduce (lambda (a b) (if (< a b) a b)) ovrly_starts))
< (message "no items in history"))))
< (defun clearOverlayBookmarks ()
< (interactive)
< (let
< ((ovrlys (filter 'overlayBookmarkFilterFunc (overlays-in (point-min) (point-max)))))
< (mapcar 'delete-overlay ovrlys)
< (message "cleared point history")))
< (defun toggleOverlayBookmark ()
< (interactive)
< (let
< ((ovrlys (filter 'overlayBookmarkFilterFunc (overlays-in (line-beginning-position) (line-end-position)))))
< (if ovrlys
< (mapcar
'delete-overlay ovrlys)
< (setOverlayBookmark))))
< (defun overlayBookmarkRefresh ()
< "stretches
the overlays from the beginning to end of a line"
< (interactive)
< (let
< ((ovrlys (filter 'overlayBookmarkFilterFunc (overlays-
in (point-min) (point-max))))
< (lf (lambda (tmp) (save-excursion
< (goto-char (overlay-start tmp))
< (move-overlay tmp (overlay-start tmp) (line-end-position)))))
< )
< (if ovrlys
< (mapcar lf ovrlys)
< (setPointHistory))))
< }}}

< I happen to bind it like this:
< {{{
< (global-set-key [C-f12] 'clearOverlayBookmarks)
< (global-set-key [f12] 'nextOverlayBookmark)
< (global-set-key [M-f12] 'toggleOverlayBookmark)
< }}}

< and f12 takes you to the next bookmark. Nothing too fancy, let me know if its useful to anyone.
< The real advantage of this system is that if you save point markers they'll inevitably move to the wrong position at some point, but emacs does a great job of keeping overlays with the text that they affect, so you can delete or insert hundreds of lines above the bookmarks and the markers will still be accurate (unlike saved point markers)
< Be default it highlights
the marked line. 'underline also works if this is too invasive (just change 'highlight to 'underline in the set function). I thought about putting something in the margin, but the elisp docs weren't too clear (you can embed an image, but not sure about color or shapes), so if someone adds this let me know.
< [new]
< bm
.el does the same thing and more. http://cvs.savannah.gnu.org/viewcvs/*checkout*/bm/bm/bm.el?rev=HEAD&content-type=text/plain

till

> contact me at (concat (format "%c%s%d%s%s" ?a "brady" (* 2 (- 1 1)) "@" "gmail") ".com")
> I'm the Director of Technology for the studio that makes City of Heroes and City of Villains. I develop almost entirely in emacs, including debugging through emacs using gdb, write up architecture docs, and I even track my tasks using it.
> Emacs is by far the most productive environment I have ever used,
and part of the reason for this is that I have embraced modifying emacs to do what I want as being part of the emacs user experience. This may sound obvious, but too many people waste time searching for a perfect elisp package to do what they want when what they want is already at their fingertips.
> My advice to you is that if you need something, and you can't find it in about ten minutes, that you do it yourself. There is no better way to make Emacs as responsive as possible. This is not hard to do, The capability of emacs is tremendous. Explore and use it.
> If you start to write elisp every day, and you start to build
a foundation of code that you understand fully, then you will become more agile, over time, and you will be able to do things faster and better than just about anybody.
> Pardon
the hyperbole. Obviously you need to know what tools to use when, and emacs isn't always the right one, but the elisp aspect is a huge component of it, and being afraid to dive in means missing a lot.
> I'm pretty bad at making contributions to the community. Usually because I feel that I don
't have anything new to contribute. But I hope my approach of posting small, simple, code snippets will be of some value. I've finally decided to post a few things I use all the time. A lot of these snippest have the same functionality already embedded in larger packages, but maybe you need to do something outside of what those packages do and just want some simple elisp as a jimping off point, and maybe my code will fill that role. I hope it does. If you find a bug or think I'm crazy, I'm always glad to hear what you think.


contact me at (concat (format “%c%s%d%s%s” ?a “brady” (* 2 (- 1 1)) “@” “gmail”) “.com”)

I’m the Director of Technology for the studio that makes City of Heroes and City of Villains. I develop almost entirely in emacs, including debugging through emacs using gdb, write up architecture docs, and I even track my tasks using it.

Emacs is by far the most productive environment I have ever used, and part of the reason for this is that I have embraced modifying emacs to do what I want as being part of the emacs user experience. This may sound obvious, but too many people waste time searching for a perfect elisp package to do what they want when what they want is already at their fingertips.

My advice to you is that if you need something, and you can’t find it in about ten minutes, that you do it yourself. There is no better way to make Emacs as responsive as possible. This is not hard to do, The capability of emacs is tremendous. Explore and use it.

If you start to write elisp every day, and you start to build a foundation of code that you understand fully, then you will become more agile, over time, and you will be able to do things faster and better than just about anybody.

Pardon the hyperbole. Obviously you need to know what tools to use when, and emacs isn’t always the right one, but the elisp aspect is a huge component of it, and being afraid to dive in means missing a lot.

I’m pretty bad at making contributions to the community. Usually because I feel that I don’t have anything new to contribute. But I hope my approach of posting small, simple, code snippets will be of some value. I’ve finally decided to post a few things I use all the time. A lot of these snippest have the same functionality already embedded in larger packages, but maybe you need to do something outside of what those packages do and just want some simple elisp as a jimping off point, and maybe my code will fill that role. I hope it does. If you find a bug or think I’m crazy, I’m always glad to hear what you think.


CategoryHomepage