0

camelCase.el emacswiki 具有取消驼峰大小写的功能。但这似乎不起作用。我将该部分添加到 camelCase.el 本身。但不能让它工作。我错过了什么?其他人有同样的问题吗?

编辑:我添加了最后两个函数,其中一个是不起作用的函数

(defun camelCase-downcase-word (count)
  "Make word starting at point lowercase, leaving point after word."
  (interactive "*p")
  (let ((start (point)))
    (camelCase-forward-word count)
    (downcase-region start (point))))

(defun un-camelcase-string (s &optional sep start)
  "Convert CamelCase string S to lower case with word separator SEP.
    Default for SEP is a hyphen \"-\".
 If third argument START is non-nil, convert words after that
    index in STRING."
  (let ((case-fold-search nil))
    (while (string-match "[A-Z]" s (or start 1))
      (setq s (replace-match (concat (or sep "_")
                                     (downcase (match-string 0 s)))
                             t nil s)))
    (downcase s)))

(provide 'camelCase)
4

1 回答 1

1

除了误导性的文档字符串(它实际上默认为“_”,而不是“-”作为分隔符)之外,un-camelcase-string您提供的定义有效。您能否详细介绍一下它是如何失败的以及在什么情况下失败?

于 2013-03-15T17:30:18.867 回答