unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Zhiwei Chen <condy0919@gmail.com>
To: 47279@debbugs.gnu.org
Subject: bug#47279: 28.0.50; hideif wrong-type-argument in org src block
Date: Sat, 20 Mar 2021 19:10:21 +0800	[thread overview]
Message-ID: <87im5maxnm.fsf@gmail.com> (raw)

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	other threads:[~2021-03-20 11:10 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-20 11:10 Zhiwei Chen [this message]
2021-03-21  3:25 ` bug#47279: 28.0.50; hideif wrong-type-argument in org src block Zhiwei Chen
2021-03-21  7:09   ` Lars Ingebrigtsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87im5maxnm.fsf@gmail.com \
    --to=condy0919@gmail.com \
    --cc=47279@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).