bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#2034: 23.0.60; c-subword-mode incompatible with xml-mode


From: Ross Patterson
Subject: bug#2034: 23.0.60; c-subword-mode incompatible with xml-mode
Date: Sun, 25 Jan 2009 10:48:36 -0800
User-agent: Gnus/5.110011 (No Gnus v0.11) Emacs/23.0.60 (gnu/linux)

Stefan Monnier <monnier@iro.umontreal.ca> writes:

>> Running "M-x c-subword-mode" in a buffer using xml-mode will raise the
>> following error:
>
>> c-update-modeline: Wrong type argument: stringp, (sgml-xml-mode "XML" "SGML")
>
> c-subword-mode is obviously written specifically for modes provided by
> the cc-*.el files.  It may accidentally work in some other modes, but at
> least c-update-modeline makes several assumptions about the format used
> for `mode-name'.

Well I find it very useful to use c-subword-mode in pretty much all my
buffers.  Here's the patched version of this function I'm using to work
around this issue:

(defun c-update-modeline ()
  (let* ((fmt (format "/%s%s%s%s"
                      (if c-electric-flag "l" "")
                      (if (and c-electric-flag c-auto-newline)
                          "a" "")
                      (if c-hungry-delete-key "h" "")
                      (if (and
                           ;; cc-subword might not be loaded.
                           (boundp 'c-subword-mode)
                           (symbol-value 'c-subword-mode))
                          "w"
                        "")))
         (str-mode-name (if (listp mode-name)
                            (nth 1 mode-name)
                          mode-name))
         (bare-mode-name (if (string-match "\\(^[^/]*\\)/" str-mode-name)
                             (substring str-mode-name (match-beginning 1) 
(match-end 1))
                           str-mode-name)))
    ;;     (setq c-submode-indicators
    ;;    (if (> (length fmt) 1)
    ;;        fmt))
    (setq mode-name
          (if (> (length fmt) 1)
              (concat bare-mode-name fmt)
            bare-mode-name))
    (force-mode-line-update)))

Ross






reply via email to

[Prev in Thread] Current Thread [Next in Thread]