[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] scratch/last-cedet-merge 783fb86 09/11: semantic: Add 'fro
From: |
David Engster |
Subject: |
[Emacs-diffs] scratch/last-cedet-merge 783fb86 09/11: semantic: Add 'fromfile' option to grammar package |
Date: |
Mon, 23 Jan 2017 21:13:49 +0000 (UTC) |
branch: scratch/last-cedet-merge
commit 783fb86bb8e79895f256c8208816baac280f2966
Author: Eric Ludlam <address@hidden>
Commit: David Engster <address@hidden>
semantic: Add 'fromfile' option to grammar package
* lisp/cedet/semantic/grammar.el (semantic-grammar-package): Add
optional 'fromfile' option. This indicates we want to make a
filename from the originating file name.
---
lisp/cedet/semantic/grammar.el | 16 +++++++++-------
1 file changed, 9 insertions(+), 7 deletions(-)
diff --git a/lisp/cedet/semantic/grammar.el b/lisp/cedet/semantic/grammar.el
index e71832f..5cd4932 100644
--- a/lisp/cedet/semantic/grammar.el
+++ b/lisp/cedet/semantic/grammar.el
@@ -266,17 +266,19 @@ That is tag names plus names defined in tag attribute
`:rest'."
No argument or nil as argument means use the current buffer."
(file-name-nondirectory (buffer-file-name buffer)))
-(defun semantic-grammar-package ()
+(defun semantic-grammar-package (&optional fromfile)
"Return the %package value as a string.
-If there is no %package statement in the grammar, return a default
-package name derived from the grammar file name. For example, the
-default package name for the grammar file foo.wy is foo-wy, and for
-foo.by it is foo-by."
- (or (semantic-grammar-first-tag-name 'package)
+If there is no %package statement in the grammar, or if FROMFILE
+is non-nil, return a default package name derived from the
+grammar file name. For example, the default package name for the
+grammar file foo.wy is foo-wy, and for foo.by it is foo-by."
+ (let ((pkgtoken (semantic-grammar-first-tag-name 'package)))
+ (if (and (not fromfile) pkgtoken)
+ pkgtoken
(let* ((file (semantic-grammar-buffer-file))
(ext (file-name-extension file))
(i (string-match (format "\\([.]\\)%s\\'" ext) file)))
- (concat (substring file 0 i) "-" ext))))
+ (concat (substring file 0 i) "-" ext)))))
(defsubst semantic-grammar-languagemode ()
"Return the %languagemode value as a list of symbols or nil."
- [Emacs-diffs] scratch/last-cedet-merge updated (74263b1 -> 592b5fe), David Engster, 2017/01/23
- [Emacs-diffs] scratch/last-cedet-merge e4e864a 02/11: semantic: Properly create canonical name for C++ type tag, David Engster, 2017/01/23
- [Emacs-diffs] scratch/last-cedet-merge b893e8a 04/11: semantic: Allow empty type relation separation character, David Engster, 2017/01/23
- [Emacs-diffs] scratch/last-cedet-merge 50139fb 08/11: semantic: Fix scope calculation for 'enum', David Engster, 2017/01/23
- [Emacs-diffs] scratch/last-cedet-merge 3cbb968 10/11: semantic: Use file name for grammar name instead of %package token, David Engster, 2017/01/23
- [Emacs-diffs] scratch/last-cedet-merge 783fb86 09/11: semantic: Add 'fromfile' option to grammar package,
David Engster <=
- [Emacs-diffs] scratch/last-cedet-merge 03bb495 07/11: semantic: Fix for Python lexer, David Engster, 2017/01/23
- [Emacs-diffs] scratch/last-cedet-merge 64484cf 06/11: semantic: Set `semantic-type-relation-separator-character' for Emacs Lisp, David Engster, 2017/01/23
- [Emacs-diffs] scratch/last-cedet-merge ebc8418 03/11: semantic: Check if slot is bound, David Engster, 2017/01/23
- [Emacs-diffs] scratch/last-cedet-merge 742013b 05/11: semantic: Improve grammar-mode, David Engster, 2017/01/23
- [Emacs-diffs] scratch/last-cedet-merge cfc56f5 01/11: semantic: Fix for db-global, David Engster, 2017/01/23
- [Emacs-diffs] scratch/last-cedet-merge 592b5fe 11/11: semantic: Improve C++ 'friend' parsing, David Engster, 2017/01/23