-
Notifications
You must be signed in to change notification settings - Fork 0
/
emacs-dxo.el
488 lines (391 loc) · 17.9 KB
/
emacs-dxo.el
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
;;; emacs-dxo -- Pascal J. Bourguignon's emacs startup files.
;;; -*- mode:emacs-lisp;lexical-binding:t;coding:utf-8 -*-
;;; Commentary:
;;; Code:
;;;;
;;;; Pascal J. Bourguignon's emacs startup file at DxO Consumers SAS.
(load "~/rc/emacs-common.el")
(.EMACS "~/rc/emacs-dxo.el %s" "Pascal J. Bourguignon's emacs startup file at DxO Consumers SAS.")
;;;----------------------------------------------------------------------------
;;; Customization
;;;----------------------------------------------------------------------------
(.EMACS "custom faces")
(custom-set-faces
;; custom-set-faces was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(font-lock-comment-face ((t (:foreground "darkgreen"))))
'(font-lock-doc-face ((t (:inherit font-lock-comment-face))))
'(font-lock-preprocessor-face ((t (:foreground "#550000"))))
'(font-lock-string-face ((t (:foreground "#aa2211"))))
'(font-lock-type-face ((t (:foreground "#6620b0"))))
'(org-done ((t (:foreground "PaleGreen" :weight normal :strike-through t))))
'(org-headline-done ((((class color) (min-colors 16) (background dark)) (:foreground "LightSalmon" :strike-through t))))
'(rst-level-1-face ((t (:background "grey20" :height 1.9))) t)
'(rst-level-2-face ((t (:background "grey20" :height 1.7))) t)
'(rst-level-3-face ((t (:background "grey20" :height 1.4))) t)
'(rst-level-4-face ((t (:background "grey20" :height 1.2))) t)
'(rst-level-5-face ((t (:background "grey20" :height 1.1 :weight bold))) t)
'(rst-level-6-face ((t (:background "grey20" :height 1.0 :weight bold))) t)
'(smerge-refined-change ((t (:background "#997722")))))
(.EMACS "custom variables")
(custom-set-variables
'(c-backslash-column (quote set-from-style))
'(c-backslash-max-column (quote set-from-style))
'(c-basic-offset (quote set-from-style))
'(c-block-comment-prefix (quote set-from-style))
'(c-cleanup-list (quote set-from-style))
'(c-comment-only-line-offset (quote set-from-style))
'(c-comment-prefix-regexp (quote set-from-style))
'(c-doc-comment-style (quote set-from-style))
'(c-echo-syntactic-information-p t)
'(c-hanging-braces-alist (quote set-from-style))
'(c-hanging-colons-alist (quote set-from-style))
'(c-hanging-semi&comma-criteria (quote set-from-style))
'(c-indent-comment-alist (quote set-from-style))
'(c-indent-comments-syntactically-p (quote set-from-style))
'(c-label-minimum-indentation (quote set-from-style))
'(c-offsets-alist (quote nil))
'(c-special-indent-hook (quote nil))
'(erc-auto-query (quote window))
'(erc-autojoin-channels-alist (quote (("freenode.net") ("irc.oftc.net" "#uml"))))
'(erc-away-timestamp-format "<%H:%M:%S>")
'(erc-echo-notices-in-current-buffer t)
'(erc-echo-timestamps nil)
'(erc-email-userid t)
'(erc-encoding-coding-alist (quote (("#emacsfr" . iso-8859-15) ("#scheme-es" . iso-8859-15))))
'(erc-fill-column 90)
'(erc-fill-function (quote erc-fill-variable))
'(erc-fill-prefix "\"\"")
'(erc-fill-static-center 0)
'(erc-fill-variable-maximum-indentation 0)
'(erc-hide-list (quote nil))
'(erc-ignore-list (quote ("ad37e918" "173.55.233.24")))
'(erc-ignore-per-channel-alist (quote (("#scheme" . "rudybot") ("#emacs" . "rudybot"))))
'(erc-ignore-per-channel-reply-alist (quote (("#scheme" . "rudybot") ("#emacs" . "rudybot"))))
'(erc-ignore-reply-list (quote nil))
'(erc-insert-away-timestamp-function (quote erc-insert-timestamp-left))
'(erc-insert-timestamp-function (quote erc-insert-timestamp-left))
'(erc-interpret-mirc-color t)
'(erc-log-write-after-insert nil)
'(erc-log-write-after-send nil)
'(erc-max-buffer-size 300000)
'(erc-minibuffer-ignored t)
'(erc-minibuffer-notice t)
'(erc-modules (quote (autoaway autojoin button completion irccontrols log match netsplit readonly replace ring scrolltobottom services stamp track truncate)))
'(erc-nick (quote ("pjb-d")))
'(erc-notice-prefix " *** ")
'(erc-pals (quote nil))
'(erc-port 6667)
'(erc-prompt (lambda nil (buffer-name (current-buffer))))
'(erc-prompt-for-password t)
'(erc-quit-reason-various-alist nil)
'(erc-save-buffer-on-part nil)
'(erc-save-queries-on-quit nil)
'(erc-server "irc.freenode.org")
'(erc-server-coding-system (quote (utf-8 . undecided)))
'(erc-server-reconnect-attempts 100)
'(erc-server-reconnect-timeout 60)
'(erc-timestamp-format nil)
'(erc-timestamp-intangible nil)
'(erc-user-full-name "Pascal J. Bourguignon")
'(eval-expression-print-length nil)
'(gnus-select-method (quote (nntp "news.individual.com")))
'(indent-tabs-mode nil)
'(mail-host-address nil)
'(message-log-max 5000)
'(org-fontify-done-headline t)
'(org-todo-keywords (quote ((sequence "TODO" "IN-PROGRESS" "REVIEW" "|" "DONE(d)") (sequence "|" "CANCELED(c)"))))
'(safe-local-variable-values (quote ((encoding . utf-8) (Readtable . PY-AST-READTABLE) (Package . CLPYTHON\.PARSER) (Readtable . PY-AST-USER-READTABLE) (Package . CLPYTHON) (Package . "CCL") (syntax . COMMON-LISP) (Package . CLPYTHON\.UTIL) (Package . CCL) (Package . CLPYTHON\.MODULE\.OPERATOR) (Syntax . COMMON-LISP))))
'(send-mail-function (quote smtpmail-send-it))
'(smtpmail-smtp-server "hubble.informatimago.com")
'(smtpmail-smtp-service 25)
'(starttls-use-gnutls nil)
'(user-mail-address "pbourguignon@dxo.com")
'(visible-bell t)
'(warning-suppress-types (quote ((undo discard-info)))))
(put 'erase-buffer 'disabled nil)
;;;----------------------------------------------------------------------------
;;; DxO specific stuff
;;;----------------------------------------------------------------------------
(push (lambda ()
(when (string-match "^/usr/local/Cellar/" (buffer-file-name (current-buffer)))
(view-mode 1)))
find-file-hook)
(deletef auto-mode-alist "\\.m$" :test (function equal) :key (function car))
(deletef auto-mode-alist "\\.mm$" :test (function equal) :key (function car))
(deletef auto-mode-alist "\\.md$" :test (function equal) :key (function car))
(appendf auto-mode-alist '(("\\.m$" . objc-mode)
("\\.mm$" . objc-mode)
("\\.md$" . text-mode)))
(push '("/src/OpticsPro-Mac.*\\.[hm]" . objc-mode) auto-mode-alist)
(require 'vc-svn)
(require 'tls)
(setf tls-program '("openssl s_client -connect %h:%p -no_ssl2 -ign_eof"
"gnutls-cli --insecure -p %p %h"
"gnutls-cli --insecure -p %p %h --protocols ssl3"))
(require 'org-jira)
(setf jiralib-url "https://jira:8443/")
(when (require 'semantic nil t)
(semantic-mode 1))
(require 'pjb-c-style)
(require 'pjb-objc-edit)
(require 'pjb-objc-ide)
(require 'dxo)
(defun dxo-objc-ide--dxo-class-type-p (type)
;; TODO: It would be better to collect the exact list of OPM classes…
(and (listp type)
(eq (second type) '*)
(null (cddr type))
(symbolp (first type))
(member* (substring (symbol-name (first type)) 0 3) '("DOP" "DXF")
:test (function string=))))
(defun dxo-objc-ide-settings ()
(interactive)
(setf *pjb-objc-ide--nslog-function* "DXFLogDebug"
*pjb-objc-ide--entry-log-tag* "PJB-DEBUG")
(pushnew '((ZoomMode) . "%d") *pjb-objc-ide--type-formatter-map*
:test (function equal))
(pushnew '(dxo-objc-ide--dxo-class-type-p . "%@") *pjb-objc-ide--type-formatter-map*
:test (function equal)))
(dxo-objc-ide-settings)
(let ((tags-add-tables t))
(setf tags-table-list '())
(ignore-errors (visit-tags-table "~/src/Cocoa.etags"))
;; ;(ignore-errors (visit-tags-table "~/src/Ruby.etags"))
(ignore-errors (visit-tags-table "~/src/OpticsPro.etags")))
;;----------------------------------------------------------------------------
;; Gherkin/Cucumber stuff.
(setf feature-default-language "en")
(setf feature-default-i18n-file "~/emacs/cucumber/i18n.yml")
(when (require 'feature-mode nil t)
(add-to-list 'auto-mode-alist '("\.feature$" . feature-mode)))
;;----------------------------------------------------------------------------
(defface gherkin-error
'((default (:foreground "red")))
"Error in Gherkin logs.")
(defface gherkin-simple
'((default (:foreground "yellow")))
"Simple lines in Gherkin logs.")
(defface gherkin-command
'((default (:foreground "blue")))
"Command lines in Gherkin logs.")
(defface gherkin-build
'((default (:foreground "grey")))
"Build lines in Gherkin logs.")
(defun gherkin-log-meat ()
(interactive)
(toggle-truncate-lines 1)
(font-lock-mode 1)
(setf font-lock-maximum-size 10000000)
(setf font-lock-keywords '())
(font-lock-add-keywords
nil
'(("^\\(error .*\\)" (1 gherkin-error))
("^\\(build .*error on line.*\\)" (1 gherkin-error))
("^\\(.*\\.m:[0-9]+: error:.*\\)" (1 gherkin-error))
("^\\(simple .*\\)" (1 gherkin-simple))
("^\\(command .*\\)" (1 gherkin-command))
("^\\(build .*\\)" (1 gherkin-build))))
(font-lock-fontify-buffer))
(put 'define-derived-mode 'lisp-indent-function 3)
(define-derived-mode gherkin-log-mode view-mode "Gherkin"
"Mode for Gherkin logs"
(gherkin-log-meat))
(deletef auto-mode-alist "/DOP-[^/]*\\.log$" :test (function equal) :key (function car))
(deletef auto-mode-alist "\\.log$" :test (function equal) :key (function car))
(appendf auto-mode-alist '(("/DOP-[^/]*\\.log$" . gherkin-log-mode)
("\\.log$" . view-mode)))
(define-derived-mode valgrind-mode compilation-mode "Valgrind"
"Mode to read valgrind log files."
(setf font-lock-keywords nil)
(font-lock-add-keywords
nil
'(("^{[^}]*}"
(0 font-lock-preprocessor-face))
("^\\(==[0-9]*==\\) \\([^ \n].*\\)$"
(1 font-lock-variable-name-face)
(2 font-lock-warning-face))
("^\\(==[0-9]*==\\) \\([^ \n].*\\)$"
(1 font-lock-variable-name-face)
(2 font-lock-comment-face))
("^\\(==[0-9]*==\\) [a-z]+ \\(0x[0-9A-F]*\\): \\([^( \n]*\\)(\\(.*\\)) (\\([^:]+:[0-9]+\\))$"
(1 font-lock-variable-name-face)
(2 font-lock-constant-face)
(3 font-lock-function-name-face)
(4 font-lock-type-face)
(5 font-lock-comment-face)))))
(add-to-list 'auto-mode-alist '("\\.\\(val\\|hel\\)grind$" . valgrind-mode))
(defun dxo-bell ()
(message "bell"))
(setf ring-bell-function 'dxo-bell)
(dolist (key (list (kbd "<C-wheel-down>")
(kbd "<S-wheel-down>")
(kbd "<wheel-down>")
(kbd "<C-wheel-up>")
(kbd "<S-wheel-up>")
(kbd "<wheel-up>")))
(global-unset-key key))
;; (setf eval-expression-print-length nil)
;;----------------------------------------------------------------------------
(when (require 'auto-complete nil t)
(dolist (mode '(python-mode-hook ruby-mode-hook lisp-mode-hook emacs-lisp-mode-hook))
(add-hook mode 'auto-complete-mode)))
;; (setf (getenv "PYTHONPATH") "/usr/local/lib/python2.7/site-packages:/usr/local/Cellar/mercurial/2.4.2/libexec")
(autoload 'jedi:setup "jedi" nil t)
(add-hook 'python-mode-hook 'jedi:setup)
(setf jedi:setup-keys t
jedi:complete-on-dot t)
(require 'confluence)
(setq confluence-url "https://confluence:8453/rpc/xmlrpc")
;;----------------------------------------------------------------------------
(require 'erc-notify)
(desktop-read)
;;----------------------------------------------------------------------------
(defparameter *opticspro-branch* "OpticsPro-Mac-branches-filmstripRefactor")
(defparameter *opticspro-branch* "OpticsPro-Mac-branches-filmstripRefactor-BCCollectionView")
(defparameter *opticspro-branch* "OpticsPro-Mac-trunk")
(set-sources (file-truename (format "~/src/%s" *opticspro-branch*)))
(require 'pjb-thi)
(set-shadow-map '(("~/src/OpticsPro-Mac-trunk/" . "~/src/OpticsPro-Mac-shadow/")
("/Volumes/Data/pbourguignon/src/OpticsPro-Mac-trunk/" . "/Volumes/Data/pbourguignon/src/OpticsPro-Mac-shadow/")
("~/src/OpticsPro-Mac-branches-filmstripRefactor/" . "~/src/OpticsPro-Mac-shadow/")
("/Volumes/Data/pbourguignon/src/OpticsPro-Mac-branches-filmstripRefactor/" . "/Volumes/Data/pbourguignon/src/OpticsPro-Mac-shadow/")))
(setf c-macro-preprocessor
(join
'("cat > /tmp/cpp.c"
";"
"SRC=$(pwd) ; while [ ! -z \"${SRC}\" -a ! -d \"${SRC}/DXOOpticsPro.xcodeproj\" ] ; do SRC=\"$(dirname \"${SRC}\")\" ; done"
";"
"/Applications/Xcode.app/Contents/Developer/usr/bin/llvm-gcc-4.2"
"-O0"
"-Wall"
"-Werror-implicit-function-declaration"
"-Wmissing-braces"
"-Wnewline-eof"
"-Wno-deprecated-declarations"
"-Wno-trigraphs"
"-Wparentheses"
"-Wreturn-type"
"-Wshadow"
"-Wshorten-64-to-32"
"-Wsign-compare"
"-Wswitch"
"-Wunknown-pragmas"
"-Wunused-function"
"-Wunused-label"
"-Wunused-value"
"-Wunused-variable"
"-arch x86_64"
"-fasm-blocks"
"-fmessage-length=0"
"-fpascal-strings"
"-fvisibility=hidden"
"-gdwarf-2"
"-mmacosx-version-min=10.6"
"-pipe"
"-std=c99"
"-x objective-c"
"-DDEBUG"
"-DDLLAPPKIT"
"-DDXF_LOG_CATEGORY=DXFAppKitUI"
"-DDXO_FOUNDATION_DYNAMIC"
"-DDXO_FWK_LOG_CATEGORY=DXFAppKitUI"
"-D_DEBUG"
"-F/Applications/Xcode.app/Contents/Developer/Library/Frameworks"
"$(find ${SRC} \\( -name \\*.app -o -name \\*.octest -o -name \\*.ibplugin \\) -prune -o \\( -name \\*.framework -print \\) |xargs -n 1 dirname |sort -u|sed -e 's/^/-F/')"
"-F${HOME}/src/OpticsPro-Mac-trunk/AppKit/bin/debug"
"-F${SRC}/AppKit/bin/debug"
"-F${SRC}/AppKit/externals/Common/bin/debug"
"-F${SRC}/bin/debug"
"-F${SRC}/externals/OCHamcrest"
"-F${SRC}/externals/OCMock"
"-framework Cocoa"
"-framework OCHamcrest"
"-framework OCMock"
"-framework SenTestingKit"
"-framework DXFAppKitUI"
"-framework DXFAppKitUI"
"$(find ${SRC} -name 'src' -o -name 'Classes' -o -name 'Tests' -o -name 'Interfaces' | sed -e 's/^/-I/')"
"-I${SRC}/AppKit/bin/debug/include"
"-I${SRC}/AppKit/build/AppKit.build/debug/DXFAppKitUI.build/DXFAppKitUI-all-target-headers.hmap"
"-I${SRC}/AppKit/build/AppKit.build/debug/DXFAppKitUI.build/DXFAppKitUI-own-target-headers.hmap"
"-I${SRC}/AppKit/build/AppKit.build/debug/DXFAppKitUI.build/DerivedSources"
"-I${SRC}/AppKit/build/AppKit.build/debug/DXFAppKitUI.build/DerivedSources/x86_64"
"-I${SRC}/AppKit/externals/Common/include/DxOFramework"
"-I${SRC}/AppKit/externals/Common/include/Foundation"
"-iquote ${SRC}/AppKit/build/AppKit.build/debug/DXFAppKitUI.build/DXFAppKitUI-generated-files.hmap"
"-iquote ${SRC}/AppKit/build/AppKit.build/debug/DXFAppKitUI.build/DXFAppKitUI-project-headers.hmap"
"-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk"
"-E"
"-c /tmp/cpp.c")
" "))
(setf c-macro-cppflags "-I. -framework /Applications/Xcode.app/Contents/Developer/Library/Frameworks/SenTestingKit.framework/Versions/A/Headers/")
(require 'pjb-xcode)
(ignore-errors (load-faces-from-xcode-dvtcolortheme "~/Library/Developer/Xcode/UserData/FontAndColorThemes/PJB Midnight.dvtcolortheme"))
(defun re-delete-lines-between (start end start-re end-re)
(interactive "rsStart regexp: \nsEnd regexp: ")
(save-excursion
(narrow-to-region start end)
(while (re-search-forward start-re nil t)
(let ((end (match-end 0)))
(goto-char (match-beginning 0))
(beginning-of-line)
(let ((start (point)))
(if (re-search-forward end-re nil t)
(progn
(goto-char (match-end 0))
(end-of-line)
(forward-char)
(delete-region start (point)))
(goto-char end)))))
(widen)))
(defun dxo-log-clean ()
(interactive)
(delete-matching-lines "not doing caf matching on unsupported image" (point-min) (point-max))
(re-delete-lines-between (point-min) (point-max)
"\\(UpdateParameters\\|DOPQuickPreview\\|DOPThumbnailsPreloadingController\\.ToThumbnailCache\\).*{"
"^\t}\\()\\| error: \\)"))
;;;----------------------------------------------------------------------------
(defun my-nxml-forward-element ()
(let ((nxml-sexp-element-flag))
(setq nxml-sexp-element-flag (not (looking-at "<!--")))
(unless (looking-at outline-regexp)
(condition-case nil
(nxml-forward-balanced-item 1)
(error nil)))))
(setf hs-special-modes-alist
(append '((lua-mode
"\\([[{(]\\|\\<\\(do\\|\\(?:functio\\|the\\)n\\)\\>\\)"
"\\([]})]\\|\\<\\(end\\)\\>\\)"
nil
lua-forward-sexp
nil)
(nxml-mode
"<!--\\|<[^/>]>\\|<[^/][^>]*[^/]>"
""
"<!--" ;; won't work on its own; uses syntax table
(lambda (arg) (my-nxml-forward-element))
nil))
(remove-if (lambda (key) (member key '(lua-mode nxml-mode)))
hs-special-modes-alist :key 'car)))
(global-set-key (kbd "<f9>") 'hs-toggle-hiding)
(defun outline-easy-bindings-meat ()
(interactive)
(require 'outline-mode-easy-bindings))
(add-hook 'outline-mode-hook 'outline-easy-bindings-meat)
(add-hook 'outline-minor-mode-hook 'outline-easy-bindings-meat)
(defun lua-mode-meat ()
(interactive)
(auto-complete-mode 1)
;; (setf outline-regexp ".*\\([[{(]\\|\\<\\(do\\|\\(?:functio\\|the\\)n\\)\\>\\)")
;; (outline-minor-mode 1)
(hs-minor-mode 1))
(add-hook 'lua-mode-hook 'lua-mode-meat)
(find-library "outline-mode-easy-bindings")
(load "~/rc/emacs-epilog.el")
;; Local Variables:
;; coding: utf-8
;; eval: (flycheck-mode -1)
;; End: