什么是{{{在Emacs中?

时间:2009-05-01 02:46:54

标签: emacs syntax-error code-folding

我在.emacs

中使用了以下内容作为评论
// {{{
// }}}

我的.emacs

;; Basic Characteristics// {{{*/
(setq c-basic-offset 4) ; indents 4 chars
(setq tab-width 4)          ; and 4 char wide for TAB
(setq indent-tabs-mode nil) ; And force use of spaces

(turn-on-font-lock)       ; same as syntax on in Vim

(setq inhibit-splash-screen t)         ; hide welcome screen// }}}*/

;;;; For Emacs' org -mode// {{{*/
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;; The following lines are always needed.  Choose your own keys.
(add-to-list 'auto-mode-alist '("\\.org\\'" . org-mode))
(global-set-key "\C-cl" 'org-store-link)
(global-set-key "\C-ca" 'org-agenda)
(global-set-key "\C-cb" 'org-iswitchb)

(global-font-lock-mode 1)                     ; for all buffers
(add-hook 'org-mode-hook 'turn-on-font-lock)  ; Org buffers only

;; This is needed for Emacs 22, not for 23
(transient-mark-mode 1)

;; To load Lisp files 

;; includes only one folder
;; (add-to-list 'load-path "~/.lisp")
;// }}}*/
;; to include all subdirectories too// {{{*/
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; 1. color theme
;;; 2. Google hyperlinks

;;; this code includes only one folder
(let ((base "/Users/Masi/.lisp"))
  (add-to-list 'load-path base)
  (dolist (f (directory-files base))
    (let ((name (concat base "/" f)))
      (when (and (file-directory-p name) 
                 (not (equal f ".."))
                 (not (equal f ".")))
        (add-to-list 'load-path name)))))

;// }}}*/
; customize hs-minor-mode// {{{*/
(add-hook 'c-mode-common-hook
  (lambda()
    (local-set-key (kbd "C-c <right>") 'hs-show-block)
    (local-set-key (kbd "C-c <left>")  'hs-hide-block)
    (local-set-key (kbd "C-c <up>")    'hs-hide-all)
    (local-set-key (kbd "C-c <down>")  'hs-show-all)
    (hs-minor-mode t)))
;// }}}*/
;; Folds// {{{*/

; to enable folding mode
(load "folding" 'nomessage 'noerror)
(folding-mode-add-find-file-hook)t

 ;;{{{ LaTeX mode stuff
 (add-hook 'TeX-mode-hook
                   '(lambda ()
                          (LaTeX-math-mode)
                          (turn-on-reftex)))
 ;;// }}}*/

我收到以下错误

Loading encoded-kb...done


An error has occurred while loading `/Users/Masi/.emacs':

error: Too many arguments

To ensure normal operation, you should investigate and remove the
cause of the error in your initialization file.  Start Emacs with
the `--debug-init' option to view a complete error backtrace.

在调试模式下,它说

Debugger entered--Lisp error: (error "Too many arguments")
  (defvar folding-package-url-location "Latest folding is available at http://cvs.xemacs.org/-xemacs-p (or (boundp 'xemacs-logo)\n                         $
  eval-buffer(#<buffer  *load*<2>> nil "/Users/Masi/.lisp/folding.el" nil t)  ; Reading at buffer position 35362
  load-with-code-conversion("/Users/Masi/.lisp/folding.el" "/Users/Masi/.lisp/folding.el" t t)
  load("folding" nomessage noerror)
  eval-buffer(#<buffer  *load*> nil "/Users/Masi/.emacs" nil t)  ; Reading at buffer position 2224
  load-with-code-conversion("/Users/Masi/.emacs" "/Users/Masi/.emacs" t t)
  load("~/.emacs" t t)
  #[nil "^H\205\276^@   \306=\203^Q^@\307^H\310Q\202A^@ \311=\2033^@\312\307\313\314#\203#^@\315\202A^@\312\307\313\316#\203/^@\317\202A^@\315\202A^@   \32$
  command-line()
  normal-top-level()

我的〜/ .lisp / folding.el

;;; folding.el --- A folding-editor-like minor mode.

;; This file is not part of Emacs

;; Copyright (C) 2000-2009
;;           Jari Aalto
;; Copyright (C) 1995, 1996, 1997, 1998, 1999
;;           Jari Aalto, Anders Lindgren.
;; Copyright (C) 1994
;;           Jari Aalto
;; Copyright (C) 1992, 1993
;;           Jamie Lokier, All rights reserved.
;;
;; Author:      Jamie Lokier <jamie A T imbolc.ucc dt ie>
;;              Jari Aalto <jari aalto A T cante dt net>
;;              Anders Lindgren <andersl A T csd.uu dt se>
;; Maintainer:  Jari Aalto <jari aalto A T cante dt net>
;; Created:     1992
;; Keywords:    tools
;;
;; [Latest XEmacs CVS tree commit and revision]
;; VCS-Version: $Revision: 3.42 $
;; VCS-URL:     http://savannah.nongnu.org/projects/emacs-tiny-tools/
;; VCS-Date:    $Date: 2007/05/07 10:50:05 $
;;
;; [Latest devel: Savannah emacs-tiny-tools revision]
;; Version:     git 56b3089

(defconst folding-version-time "2009.0220.1404"
  "Last edit time in format YYYY.MMDD.HHMM.")

;;{{{ GPL

;; This program is free software; you can redistribute it and/or
;; modify it under the terms of the GNU General Public License as
;; published by the Free Software Foundation,
;; or (at your option) any later version.
;;
;; GNU Emacs is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with program. If not, write to the
;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
;; Boston, MA 02110-1301, USA.
;;
;; Visit <http://www.gnu.org/copyleft/gpl.html> for more information

;;}}}

;;; Commentary:

;;{{{ Introduction

;; Preface
;;
;;      This package provides a minor mode, compatible with all major
;;      editing modes, for folding (hiding) parts of the edited text or
;;      program.
;;
;;      Folding mode handles a document as a tree, where each branch
;;      is bounded by special markers `{{{' and `}}}'. A branch can be
;;      placed inside another branch, creating a complete hierarchical
;;      structure.
;;
;;      Folding mode can CLOSE a fold, leaving only the initial `{{{'
;;      and possibly a comment visible.
;;
;;      It can also ENTER a fold, which means that only the current
;;      fold will be visible, all text above `{{{' and below `}}}'
;;      will be invisible.
;;
;;      Please note, that the maintainers do not recommend to use only
;;      folding for you your code layout and navigation. Folding.el is
;;      on its best when it can "chunk" large sections of code inside
;;      folds. The larger the chunks, the more the usability of
;;      folding will increase. Folding.el is not meant to hide
;;      individual functions: you may be better served by hideshow.el
;;      or imenu.el (which can parse the function indexes)

;;}}}
;;{{{ Installation

;;  Installation
;;
;;      To install Folding mode, put this file (folding.el) on your
;;      Emacs `load-path' (or extend the load path to include the
;;      directory containing this file) and optionally byte compile it.
;;
;;      The best way to install folding is the autoload installation,
;;      so that folding is loaded into your emacs only when you turn on
;;      `folding-mode'. This statement speeds up loading your .emacs
;;
;;          (autoload 'folding-mode          "folding" "Folding mode" t)
;;          (autoload 'turn-off-folding-mode "folding" "Folding mode" t)
;;          (autoload 'turn-on-folding-mode  "folding" "Folding mode" t)
;;
;;      But if you always use folding, then perhaps you want more
;;      traditional installation. Here Folding mode starts
;;      automatically when you load a folded file.
;;
;;          ;; (setq folding-default-keys-function
;;          ;;      'folding-bind-backward-compatible-keys)
;;
;;          (if (load "folding" 'nomessage 'noerror)
;;              (folding-mode-add-find-file-hook))
;;
;;      Folding uses a keymap which conforms with the new Emacs
;;      (started 19.29) style. The key bindings are prefixed with
;;      "C-c@" instead of old "C-c". To use the old keyboard bindings,
;;      uncomment the lines in the the above installation example
;;
;;      The same folding marks can be used in `vim' editor command
;;      "set fdm=marker".
;;
;;  Uninstallation
;;
;;      To remove folding, call `M-x' `folding-uninstall'.
;;
;;  To read the manual
;;
;;      At any point you can reach the manual with `M-x'
;;      `finder-commentary' RET folding RET.

;;}}}
;;{{{ DOCUMENTATION

;;  Compatibility
;;
;;      Folding supports following Emacs flavors:
;;
;;          Unix Emacs  19.28+ and Win32 Emacs  19.34+
;;          Unix XEmacs 19.14+ and Win32 XEmacs 21.0+
;;
;;  Compatibility not for old NT Emacs releases
;;
;;      NOTE: folding version starting from 2.47 gets around this bug
;;      by using adviced kill/yank functions. The advice functions are
;;      only instantiated under problematic NT Emacs versions.
;;
;;      Windows NT/9x 19.34 - 20.3.1 (i386-*-nt4.0) versions contained
;;      a bug which affected using folding. At the time the bug was
;;      reported by Trey Jackson <trey A T cs berkeley edu>
;;
;;          If you kill folded area and yank it back, the ^M marks are
;;          removed for some reason.
;;
;;          Before kill
;; packages or modes
;;
;;      Folding.el was designed tofor big files. Sometimes people misunderstand the
;;       better job. Trying to wrap
;;      individual functions insis not where folding is
;;      it's best. Grouping several f logical fold-block
;;      in the other is. So, to choose a our need,
;;      here are some suggestions,:
;;
;;      o  Naation of imenu.el, speedbar.el and
;;         hideshow.el
;;  ng.el
;;      o  For text, `outline-mode' is more non-intrusive.
;;         Look at Emacs NEWS file (`C-x' `n') and you can se: `M-x' `folding-mode'
;;      `RET'. The mode line should cont When loading a document containing fold marks, Folding mode ised. For example when
;;      loading my init file, only the follines
;;      of comments) are visible:
;;
;;          ;;{{{ Ge  ;;{{{ Keyboard...
;;          ;;{{{ Packages...
;;          ;;          ;;{{{ Minor modes...
;;          ;;{{{ Debug...
;;
;t entering,
;;      use `C-c @ C-s', which produces this displa
;;          ;;}}}
;;
;;      To show everything, just as the fook like if
;;      Folding mode hadn't been activated, give thT', normally bound to `C-c' `@'
;;      `C-o'.  To close all foevel, the
;;      command `folding-whole-buffer' could be used.ouse support
;;
;;      Folding mode v2.0 introduced mouse support. Folds can be shown
;;      or hidden by simply clicking ondidn't click on a
;;      fold mark.
;;
;;  The menu
;;
;;      placed in the "Tools" menu. Should no Tools menu exist
;;     he menu will be placed in the menu bar.
;;
;;  ISearch
;;
;;    incremental search (C-s) facilities,
;;      folds will be aut;;
;;  Problems
;;
;;     Uneven fold marks
;;
;;      Oops, I        ;;{{{
;;          ;;}}}
;;
;;     folding-whole-buffer d whole buffer
;;
;;      If you call commands `folding-open-bufd
;;      `folding-whole-buffer' and notice that there are open;;      sections in the buffer, then you have mismatch of foldspen or closing fold mark.
;;
;;  Folding and outline modes
;;
;ame as Outline mode, a major and
;;      minor mode which is pahe Emacs distribution. The two
;;      packages do, however, re other very much.  The main
;;      differences between the twore:
;;
;;      o   Folding mode uses explicit marks, `{{{' and `}}}', to
;;          mark the beginning and the end of a branch.
;;          Outline, on the other other hand, tries to use already
;;          existing marks, like the `\section' string in a TeX
;;          document.
;;
;;      o   Outline mode has no end marker which means that it is
;;          impossible for text to follow a sub-branch.
;;
;;      o   Folding mode use the same markers for branches on all depths,
;;          Outline mode requires that marks should be longer the
;;          further, down in the tree you go, e.g `\chap', \section',
;;          `\subsection', `\subsubsection'. This is needed to
;;          distinguish the next mark at the current or higher levels
;;          from a sub-branch, a problem caused by the lack of
;;        end-markers.
;;
;;      o   Folding mode has mouse suppoyou can navigate through a
;;          folded document by clicksion
;;          of Outline mode has mouse support.)
;;
;;      of Folding is capable of
;;          automatically to open folthe the entire
;;          document must be opened prior isearcutline mode is useful when the document being
;;      edited coers are hard to find, except if you're happy with
;;      one fn per fold.
;;
;;  Future development ideas
;;
;;      The planinning to rewrite the entire package.
;;      Including replacithe program, written using
;;      old Emacs technology (selectys or text-properties for
;;      Emacs and extents for XEmacs.;;
;;      It is not likely that any of this will come true coning
;;      the time required to rewrite the core of the package. Since
;;      the package, in it's current state, is much more powerful than
;;      the original, it would be appropriate to write such package
;;      from scratch instead of doing surgery on this one.

;;}}}

;;{{{ Customization

;;  Customization: general
;;
;;      The behavior of Folding mode is controlled mainly by a set of
;;      Emacs Lisp variables. This section will discuss the most
;;      useful ones, for more details please see the code. The
;;      descriptions below assumes that you know a bit about how to
;;      use simple Emacs Lisp and kt ~/.emacs, your
;;      init file.
;;
;;  Customization: hooks a
;;      function doing the customization. The function is the see
;;      the example section below.)  The following hooks lding mode is activated.
;;      o   `<major mode>-folding-hookjor
;;           mode set to <major mode>. (e.g. When editing C    the hook `c-mode-folding-hook' is called.)
;;      o   `fol        Called when folding mode is loaded into Emacs.
;;
;;  C     it is used by outline-minor-mode. It is not likely that fe try to use folding and outline at the same time.
;;
;;      Ho.  The
;;      variable `folding-default-keys-function' specifiing line to your
;;      init file:
;;
;;          (setq folding-default-keys-function
;;                'folding-bind-backward-compatible-keys)
;;
;;      To define keys similar to the keys used by Outline mode, use:
;;
;;          (setq folding-defaut-keys-function
;;                'folding-bind-outline-compati-keys)
;;
;;  Customization: adding new major modes
;;
;;      To add fold marks for a new major mode, use the function
;;      `folding-add-to-marks-list'. The command also replaces
;;     existing marks. An example:
;;
;;          (folding-add-to-marks-list
;;           'c-mode "/* {{{ " "/* }}} */" " */" t)
;;
;  Customization: ISearch
;;
;;      If you don't like the extension folding.el applies to isearch,
;;      set the variable `folding-isearch-install' to nil before
;;      loading this pacndard
;;      ones, you can do like this:
;;
;;           (setqs-function
;;               '(folding-bind-backward-compatible-   "Folding setup."
;;
;;             (folding-install)  ;; jus;; ............................................... markers ...
;;             ;;  sh/perl/awk code
;;
;;             (defvar f-marks-alist nil)
;;
;;             (let* ((ptr (assq 'text-mode folding-mode-marks-alist)))
;;               (setcdr ptr (list "# {{{" "# }}}")))
;;
;;             ;; .....................rrent-entry)
;;             (define-key folding-mode-prefix-map                        'folding-whole-buffer))
;;
;;  Example:;;          (defun my-folding-load-hook ()
;;            "Foldi;  Change marks for 'text-mode'
;;            (let* ((ptr (assqing-mode-marks-alist)))
;;              (setcdr ptr (list "# {{xample: choosing different fold marks for mode
;;
;;      Suppoerent fold marks for the
;;      major mode: e.g. to alternate             (defun my-folding-text-mode-setup (&optional use-cu             (interactive
;;                (list (y-or-n-p "Us;              (let* ((ptr (assq major-mode folding-mode-marks-          (when (eq major-mode 'text-mode)
;;                                  (setq  begin default-begin  end default-end)))
;;                (setcdr ptr (list begin end))
;;             f these 3 is to be folded at any
;;      one time, using a simpomment types, e.g., "unfold
;;      everything then fold on \x";;
;;          \O   ...  \endO
;;          \L   ...  \endL
;;         "Folding vars setup."
;;            (let ((ptr (assq 'te;;              (define-key folding-mode-prefix-map "C"
;;                         'my-folding-marks-change)))
;;
;;          ctive "P")
;;            (let ((ptr (assq major-mode folding-mome  major-mode))
;;                (setq input
;;              read-string "Latex \\end(X) Marker (default O): "
;;                       (setq input (upcase input))
;;                (turnncat "\\" input) (concat "\\end" input)))
;;                (tu      ;;  End of example
;;
;;  Bugs: Lazy-shot.el conflict in  in the minibuffer and XEmacs freezes.
;;
;;      The strange phat I have this bug only under Solaris
;;      2.5 sparc (binar.6 x86. (XEmacs 20.4, folding 2.35). I will try to access
;;   ;;      the XEmacs people I you can reproduce it.

;;}}}
;;{{{  Documentation

;;  Old documentation
;;
;;      The following s written by Jamie Lokier for the release
;;      of Folding V1t is included here for no particular reason:
;;
;;      Emacs 1 frames, then move in
;;      and out of folds in the buffer. Tnerally in order to
;;      avoid some Emacs display "features"ome of it is specific to
;;      certain versions of Emacs. By ;;
;;  More known bugs
;;
;;      *** Needs folding-fold-regionk out what happens when you
;;      exit a fold with the file dat sometime.
;;
;;  Future features
;;
;;      *** I will add a earlier versions does not count line-numbers in the right
;;  ve.
;;
;;      *** Fold titles should be optionally allowed on invisible text-properties (I hope they are intended to
;;      sible; it isn't implemented like that yet), it
;;      will be ed text without affecting the
;;      text of the buffer. At thrns for line-feeds in the buffer. This isn't such
;;      a gooeven more text-properties, it may be possible to track
;;      and out of folds, and have Folding mode
;;      automatically e necessary to maintain a
;;      sensible display. Because the dified (if
;;      overlays are used to hide text), this is quiorward-char', `folding-goto-line' or
;;      `folding-next-erromight make it possible to
;;      avoid using narrowing. This m3cff7]
;; - Minor documentaton fixes.
;; - Add new `python-mode        [jari 3.36-3.37 2006.1118]
;; - Jeremy Hankins <nowan An org> sent a patch, which
;;   adds variable `folding-narrow-batch affects
;;   mostly `folding-shift-in'. This makes it possader to the beginning for canonnical location.
;;   Updated maid from bibtex-mode.
;;   Changed bib-mode '@comment' => '%'. Clian
;;   Bug#282388
;;
;; Sep  10  2004  21.3             [jari0]
;; - (folding-fold-region): caused to indent bottom fold
;; -mode. Disabled
;;   running `indent-according-to-mode' while i;   Bug reported by Uwe Brauer; oub A T mat dot ucm dot es
;; -whole buffer.
;; - Changed version scheme to date based YYYY.MMed unnecessary 'all rights reserved'.
;; - (folding-check-foldeter, which
;; - protected all email addresses by removing AT-si2.111-2.115]
;; - Merged in changes made by 2003-11-12  Adrian ;   using different expansion macros for XEmacs and Emacs.
;;  rg/xemacs-beta/199810/msg00039.html
;; - (folding-forward-char- 2.112 Renamed.
;;   Was `folding-forward-char'.
;;   (folding-ar-1): 2.112 Renamed.
;;   Was `folding-backward-char'.
;;   (fion with '_p' interactive spec.
;;   (folding-backward-char-macolding-interactive-spec-p): 2.112 New.
;;

[...]

2 个答案:

答案 0 :(得分:3)

.emacs中的代码中至少有一个错误,在这里:

; to enable folding mode
(load "folding" 'nomessage 'noerror)
(folding-mode-add-find-file-hook)t

t表示语法错误。可能只是一种类型的frpom切割和粘贴。

关于错误,Trey说得对,事实上我想我知道错误可能是什么:不知何故,字符串中的尾随引号标记

"Latest folding is available at http://cvs.xemacs.org/-xemacs-p

失踪了。从这两个问题中,我怀疑你的来源是腐败的。

答案 1 :(得分:1)

看起来您的折叠文件/Users/Masi/.lisp/folding.el有问题,我们需要查看其中的内容以确定错误。我这样说的原因是堆栈跟踪通过调用load-with-code-conversion - 显示正在加载的folding.el文件。

如果您查看最新版本,请找到here(版本3.42),开头的行

(defvar folding-package-url...

正确形成。但是,你的堆栈跟踪看起来有一些lisp代码以某种方式使它成为字符串。即:

(or (boundp 'xemacs-logo)

尝试下载新的副本。