unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Kaushal Modi <kaushal.modi@gmail.com>
To: John Wiegley <johnw@gnu.org>,
	Kaushal Modi <kaushal.modi@gmail.com>,
	 Emacs developers <emacs-devel@gnu.org>,
	Juri Linkov <juri@linkov.net>
Subject: Re: Considering hi-lock-file-patterns as safe
Date: Thu, 18 Feb 2016 11:38:36 -0500	[thread overview]
Message-ID: <CAFyQvY01QKXZqYxRs4=5FPGakV9Gk5r_rsh4=qPrBFPLgvCV3A@mail.gmail.com> (raw)
In-Reply-To: <m2twl7q63f.fsf@newartisans.com>

[-- Attachment #1: Type: text/plain, Size: 3467 bytes --]

On Wed, Feb 17, 2016 at 6:17 PM, John Wiegley <jwiegley@gmail.com> wrote:

> >>>>> Kaushal Modi <kaushal.modi@gmail.com> writes:
>
> > So now I am wondering if this variable can be marked permanently as safe
> > within the library itself. That way people can customize it in their .
> > dir-locals.el files without this hack.
>
> Do we have a precedent for doing this elsewhere?


I don't see a single occurrence of

(put 'SOME-VAR 'safe-local-variable 'identity)

in the emacs source.

Here is how I set the hi-lock-text-patterns in my .dir-locals.el

((text-mode . ((hi-lock-file-patterns . (;; UVM_WARNING
                                         ("^\\s-*\\(UVM_WARNING\\)\\s-+[^:]"
                                          (1 '(:inherit default
                                               :foreground "black"
                                               :background "orange"
                                               :height 1.1)
                                             prepend))

 ("^\\s-*\\(UVM_WARNING\\s-+:\\s-+[1-9][0-9]*\\)"
                                          (1 '(:inherit default
                                               :foreground "black"
                                               :background "orange"
                                               :box (:line-width 2 :color
"green")
                                               :height 1.1
                                               :weight bold)
                                             prepend))
                                         ;; UVM_ERROR
                                         ("^\\s-*\\(UVM_ERROR\\)\\s-+[^:]"
                                          (1 '(:inherit default
                                               :foreground "white"
                                               :background "red"
                                               :height 1.1)
                                             prepend))

 ("^\\s-*\\(UVM_ERROR\\s-+:\\s-+[1-9][0-9]*\\)"
                                          (1 '(:inherit default
                                               :foreground "white"
                                               :background "red"
                                               :box (:line-width 2 :color
"green")
                                               :height 1.1
                                               :weight bold)
                                             prepend)))))))

As I couldn't figure out how to qualify that alist value of
hi-lock-file-patterns, I used 'identity as the qualifier.

But I do see instances of marking variables as safe (just not using
'identity, which understandably is very risky):

24793:(put 'sh-shell 'safe-local-variable 'symbolp)
25436:(put 'sort-fold-case 'safe-local-variable 'booleanp)
25510:(put 'sort-numeric-base 'safe-local-variable 'integerp)
28175:(put 'time-stamp-format 'safe-local-variable 'stringp)
28176:(put 'time-stamp-time-zone 'safe-local-variable 'string-or-null-p)
28177:(put 'time-stamp-line-limit 'safe-local-variable 'integerp)
28178:(put 'time-stamp-start 'safe-local-variable 'stringp)
28179:(put 'time-stamp-end 'safe-local-variable 'stringp)
28180:(put 'time-stamp-inserts-lines 'safe-local-variable 'symbolp)


So the question would be:
- If we were to mark hi-lock-file-patterns as safe in hi-lock.el itself,
what would be a valid qualifier so that I can set its value as shown above
in my .dir-locals.el?

--
Kaushal Modi

[-- Attachment #2: Type: text/html, Size: 5633 bytes --]

      reply	other threads:[~2016-02-18 16:38 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-16 15:02 Considering hi-lock-file-patterns as safe Kaushal Modi
2016-02-17 23:17 ` John Wiegley
2016-02-18 16:38   ` Kaushal Modi [this message]

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='CAFyQvY01QKXZqYxRs4=5FPGakV9Gk5r_rsh4=qPrBFPLgvCV3A@mail.gmail.com' \
    --to=kaushal.modi@gmail.com \
    --cc=emacs-devel@gnu.org \
    --cc=johnw@gnu.org \
    --cc=juri@linkov.net \
    /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).