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

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

bug#47279: 28.0.50; hideif wrong-type-argument in org src block


From: Zhiwei Chen
Subject: bug#47279: 28.0.50; hideif wrong-type-argument in org src block
Date: Sat, 20 Mar 2021 19:10:21 +0800

How to reproduce:
    emacs -Q --eval '(progn
(require (quote org))
(require (quote hideif))
(add-hook (quote c-mode-hook) (quote hide-ifdef-mode))
(setq hide-ifdef-initially t)
(setq hide-ifdef-shadow t))'

Then edit an org file that contains a src block for C.

#+begin_src C
  void foo() { }
#+end_src

C-c ' on that src block will echo an error message:

    Initialization fails with: "Wrong type argument: stringp, nil"

Since C-c ' opens a special buffer that hasn't a file related, the
`buffer-file-name' will return `nil'. It's the second parameter of
`string-match' in `hide-ifdef-gets'.

The definition of `hide-ifdef-guts` follows.

(defun hide-ifdef-guts ()
  "Does most of the work of `hide-ifdefs'.
It does not do the work that's pointless to redo on a recursive entry."
  ;; (message "hide-ifdef-guts")
  (save-excursion
    (let* ((case-fold-search t) ; Ignore case for `hide-ifdef-header-regexp'
           (expand-header (and hide-ifdef-expand-reinclusion-protection
                               (string-match hide-ifdef-header-regexp
                                             (buffer-file-name))
                               (zerop hif-recurse-level)))
           (case-fold-search nil)
           min max)
      (goto-char (point-min))
      (setf min (point))
      (cl-loop do
               (setf max (hif-find-any-ifX))
               (hif-add-new-defines min max)
               (if max
                   (hif-possibly-hide expand-header))
               (setf min (point))
               while max))))

-- 
Zhiwei Chen





reply via email to

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