Trac is being migrated to new services! Issues can be found in our new YouTrack instance and WIKI pages can be found on our website.

Version 3 (modified by John Bailey, 13 years ago) (diff)

--

Editor Configuration Snippets

Emacs

Suppose your personal preferred indentation style is dissimilar from the Pidgin indentation style, but you're a team player and you want to use Pidgin indentation when working on Pidgin/libpurple/whatever. These snippets can help you with that.

(c-add-style "pidgin" '((c-tab-always-indent . t)
                        (c-basic-offset . 8)
                        (indent-tabs-mode . t)))

(defun pidgin-c-mode-init ()
  (if (or (posix-string-match "some/path/snippet" (buffer-file-name))
          (posix-string-match "code/pidgin" (buffer-file-name)))
      (c-set-style "pidgin")))

(add-hook 'c-mode-hook 'pidgin-c-mode-init)

Make sure this hook runs after your normal setup hook, if your normal hook sets a style. The or is included just to show how to match multiple paths. You may perform the selection however you like, path snippets just happen to be useful given my filesystem organization. -- elb

VIM

Regardless of what the indentation style and tab width convention is in the rest of the tree, the ChangeLog and NEWS files should always use a tab width of 8. This may not be the right or best .vimrc snippet to do this, but it works. Insert this snippet into .vimrc (.gvimrc for you GUI addicts) after your existing tab configuration:

autocmd! BufReadPost,BufNewFile */ChangeLog call <SID>ChangeLogNewsOptions()
autocmd! BufReadPost,BufNewFile */NEWS call <SID>ChangeLogNewsOptions()

function! <SID>ChangeLogNewsOptions()
    " These settings affect ChangeLog and NEWS files only
    setlocal sw=8
    setlocal tabstop=8
endfunction

It's ugly, but it works. -- rekkanoryo

All information, including names and email addresses, entered onto this website or sent to mailing lists affiliated with this website will be public. Do not post confidential information, especially passwords!