unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#47279: 28.0.50; hideif wrong-type-argument in org src block
@ 2021-03-20 11:10 Zhiwei Chen
  2021-03-21  3:25 ` Zhiwei Chen
  0 siblings, 1 reply; 3+ messages in thread
From: Zhiwei Chen @ 2021-03-20 11:10 UTC (permalink / raw)
  To: 47279

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





^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-03-21  7:09 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-20 11:10 bug#47279: 28.0.50; hideif wrong-type-argument in org src block Zhiwei Chen
2021-03-21  3:25 ` Zhiwei Chen
2021-03-21  7:09   ` Lars Ingebrigtsen

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).