Question

i want to mark buffers, that have unsaved changes, in the tabbar tab bar in emacs. Also i want to assign F1 - F12 to the buffer and open them by pressing the according button. But since i have no programming practice in lisp, i have no idea where to start. Also i got the feeling that learning lisp to know how to configure emacs on a low lwevel is an incredible usefull skill.

So my question is not really how to archieve that, but rather where to start looking. And maybe how to start learning Lisp.

Thanks

Was it helpful?

Solution 4

You can also look at tabbar.el to try and figure out where the actual text of the bar is created (i.e. where you'll want to add the "unsaved" indicators). To figure out if a buffer has unsaved changes, you can use the buffer-modified-p function.

OTHER TIPS

This following code works with stock versions of Emacs and tabbar.el -- it creates + sign at the beginning of the modified buffer name in the tab.

;; BUFFER MODIFICATION STATE INDICATOR
(defadvice tabbar-buffer-tab-label (after fixup_tab_label_space_and_flag activate)
   (setq ad-return-value
         (if (and (buffer-modified-p (tabbar-tab-value tab))
                  (buffer-file-name (tabbar-tab-value tab)))
             (concat " + " (concat ad-return-value " "))
           (concat " " (concat ad-return-value " ")))))
(defun ztl-modification-state-change ()
   (tabbar-set-template tabbar-current-tabset nil)
   (tabbar-display-update))
(defun ztl-on-buffer-modification ()
   (set-buffer-modified-p t)
   (ztl-modification-state-change))
(add-hook 'after-save-hook 'ztl-modification-state-change)
(add-hook 'first-change-hook 'ztl-on-buffer-modification)

If you want to take it one step further, look at the source code for aquamacs-tabbar.el -- it contains customizable options such as tabbar-unselected-modified and tabbar-selected-modified. You would either need to use Aquamacs for the options mentioned above, or you would need to make a few revisions to the following files so that they work with a stock version of Emacs: aquamacs-tabbar.el, tabbar.el, and tabbar-window.el:

https://github.com/davidswelt/aquamacs-emacs/tree/master/aquamacs/src/site-lisp/tabbar


See also this example of possibilities to further customize the look and feel.

screenshot
(source: lawlist.com)

As sds mentioned, you'll have to go through the info pages. You could do C-h i m Emacs Lisp RET as mentioned by sds, or you could do M-x info and then find the Emacs Lisp Intro from there.

You raised too many issues in a single question.

I will respond briefly to each, but you should ask a separate question if you are not clear.

i want to mark buffers, that have unsaved changes, in the tabbar tab bar in emacs.

No, you do not want that. This is already done in the mode line.

i want to assign F1 - F12 to the buffer and open them by pressing the according button

No, you do not want that. Keys are precious, you do not want to waste them like that. Use Mouse Buffers menu or list-buffers.

how to start learning Lisp

In Emacs, type C-h i m Emacs Lisp Intro RET and start reading.

Emacs is superbly customizable, and you can make it do exactly what you want. However, you must realize that it has been used for over 30 years by many smart people, so, whenever your wish is reasonable, chances are this can be done out of the box, and if not, you will have a lot of fun implementing it yourself.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top