作者 Anonymous [actionscript] 2010-12-27 11:51 (点击下载)

  1. (defvar libreoffice-path-regexp
  2. "libreoffice"
  3. "Regexp that matches paths into your LibreOffice source tree.")
  4.  
  5. (defun libreoffice-c-hook ()
  6. "Set C++ style and tab stops to match LO style."
  7. (when (string-match libreoffice-path-regexp buffer-file-name)
  8. (message "Using LibreOffice code settings")
  9. (setq tab-width 4)
  10. (setq tab-stop-list '(4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72
  11. 76 80 84 88 92 96 100 104 108 112 116 120))
  12. (c-set-style "stroustrup")
  13. (set-variable 'c-basic-offset 4)
  14. (set-variable 'indent-tabs-mode nil)
  15. (let ((env-file (libreoffice-set-env-file buffer-file-name)))
  16. (setq compile-command (if (null env-file)
  17. "dmake"
  18. (concat ". "
  19. (file-relative-name env-file)
  20. "; dmake"))))))
  21. (add-hook 'c-mode-common-hook 'libreoffice-c-hook)
  22. (add-to-list 'auto-mode-alist (cons "\\.sdi\\'" 'c++-mode))
  23. (add-to-list 'auto-mode-alist (cons "\\.hrc\\'" 'c++-mode))
  24. (add-to-list 'auto-mode-alist (cons "\\.src\\'" 'c++-mode))
  25. ;; stolen from vc-hooks.el (vc-find-root)
  26. (defun libreoffice-src-dir (file)
  27. "Find the root of an LibreOffice source directory.
  28. Find the root of the LibreOffice source directory that
  29. contains FILE, or nil if FILE is not in such a directory"
  30. (let ((dir nil))
  31. (while (not (or dir
  32. (equal file (setq file (file-name-directory file)))
  33. (null file)))
  34. (if (file-exists-p (expand-file-name "solenv" file))
  35. (setq dir file)
  36. (setq file (directory-file-name file))))
  37. dir))
  38. (defun libreoffice-set-env-file (file)
  39. "Find LO *Env.Set.sh script.
  40. Returns the name of the solar environment setter script for the
  41. LibreOffice source tree to which FILE belongs. Unix-only."
  42. (let* ((root (libreoffice-src-dir file))
  43. (files (and root
  44. (file-expand-wildcards
  45. (expand-file-name "*Env.Set.sh" root)))))
  46. (if (null files) files (car files))))

提交下面的校正或者修改. (点击这里开始一个新的帖子)
姓名: 在 cookie 中记住我的名字

屏幕抓图:(jpeg 或 png)